TECHNOLOGY FOCUS - BIOLOGY - Preferred Component: The sludge has high content of bacterial, viral, and/or parasitic pathogen, which includes pathogen(s) selected from enteropathogenic Escherichia coli, Salmonella, Shigella, Yersinia, Vibrio cholerae, Cryptosporidium, Giardia, Entamoeba, Norovirus, or Rotavirus. The acid-producing, sulfur-oxidizing bacteria for bioleaching is Acidithiobacillus thiooxidans, Leptospirillum ferrooxidans, Acidithiobacillus ferrooxidans, Thiobacillus thiooxidans, T. ferrooxidans, Acidiphilium cryptum, A. multivorum, A. symbioticum, A. angustum, Acidocella aminolytica, A. facilis, Sulfobacillus thermosulfidooxidans, Ferroplasma acidarmanus, Metallosphaera sedula, Sulfolobus acidocaldarius, or S. solfataricus. The microorganism producing biofuel or bioenergy product is Methanococcus sp., Methanomicrobium sp., Methanospirillum sp., Methanoplanus sp., Methanosphaera sp., Methanolobus sp., Methanoculleus sp., Methanosaeta sp., Methanopyrus sp., Methanocorpusculum sp., Methanosarcina, Klyveromyces sp., Methylomonas sp., Methylosinus sp., or Methylococcus sp.. Methanogenic microorganisms are one or a consortium of Methanosarcina, Methanosaeta, and/or Methanothrix species. The microorganism is fermentative microorganism(s), which includes Zymomonas sp. and/or Saccharomyces sp., and Clostridium sp.. The photosynthesis bioreactor includes one or consortium of Synechococcus sp., Chlorella sp., Synechocystis sp., Nitzschia sp., and/or Schizachyrium sp.; or Cyanobacteria or algae.    TECHNOLOGY FOCUS - BIOTECHNOLOGY - Preferred Method: The method operates in batch, semi-continuous, or continuous. It further comprises separating the liquid phase from biomass when pH is 1-4; precipitating heavy metals from the liquid phase by restoring the pH; removing precipitated heavy metals; and adding the liquid phase back to the biomass. Synthesis of biofuels takes place in anaerobic reactor(s). The biofuel synthesis takes place in photosynthesis bioreactor(s), which is a multiphasic bioreactor having photosynthetic microorganisms forming biofilms on support surfaces, where photosynthetic microorganisms are supported by effluent carbon dioxide from anaerobic bioreactor. The method further comprises recovering the biofuel or bioenergy product from liquid material by molecular sieve or distillation. The biogas containing hydrogen and/or methane is drawn off from the system as pipeline gas. Hydrogen and methane are purified from biogas. Preferred Equipment: The bioleaching system further comprises tubular reactor. It obtains a sludge pH of 1-4. The anaerobic reactor is a multiphasic bioreactor for production of methane, ethanol, butanol, or methanol; or upflow anaerobic sludge blanket (USAB) reactor of expanded sludge bed digester (EGSB) reactor. The bioleaching reactor contains an inlet for influent sewage sludge. The bioleaching system contains a first outlet for effluent heavy metals, and a second outlet for effluent liquid having a reduced level of heavy metals. It comprises a continuous stirred-tank reactor, which is followed by a tubular reactor; and a recipient unit for receiving sludge having solubilized heavy metals, and comprising a centrifuge. The anaerobic bioreactor is a multiphasic bioreactor containing fermentative or methanogenic microbes forming biofilms on solid supports; and an outlet for transporting the biofuels and bioenergy products. It contains an in-series connection to transport gas effluent from the anaerobic reactor to the photobioreactor. The photobioreactor contains an inlet for liquid media. The integrated system further comprises a feedback connection between the anaerobic bioreactor to the bioleaching reactor; and system of pumps and/or valves operably connecting inlets and outlets. The working volume of the integrated system is 100-100000 gallons.    TECHNOLOGY FOCUS - INORGANIC CHEMISTRY - Preferred Component: The sludge is supplemented with an aqueous phase containing mineral salt medium, which comprises sulfur substrate for supporting the action of sulfur-oxidizing bacteria.    TECHNOLOGY FOCUS - METALLURGY - Preferred Component: The sludge has high content of heavy metals, which are zinc, lead, copper, chromium, nickel, cadmium, and/or mercury. Preferred Parameter: Heavy metal(s) is present in the sludge at more than 100, preferably 400-1000 ppm. Preferred Method: The leaching of metals takes place in a bioleaching system comprising continuous stirred-tank reactor(s). The metals are recovered after solubilization.