A method for cultivating fungal cells, said method comprising the steps of a. providing a biomass material comprising solid and liquid parts from a biogas fermenter following an anaerobic fermentation and biogas production, b. subjecting the fermented biomass material of step a) to one or more separation steps resulting in the provision of i) a fibrous solid fraction comprising organic and inorganic nitrogen parts, and having a reduced content (w/w) of water, and comprising one or more macromolecular nutrient constituents selected from the group consisting of cellulose, hemicellulose, lignin and lignocellulose, and ii) at least one liquid fraction comprising solid and liquid organic and inorganic phosphor-containing parts, c. subjecting the fibrous solid fraction of step b) to a sanitation and N-stripping treatment comprising the steps of i) heating the fibrous solid fraction to a temperature of more than 70°C, optionally under alkaline pH conditions, and optionally ii) subjecting the fibrous solid fraction comprising organic and inorganic nitrogen parts to a pressure of more than 1 bar, wherein said treatment i) reduces or eliminates viable microorganisms present in the fibrous solid fraction, and ii) reduces the contents of volatile nitrogen-containing compounds and/or precursor volatile compounds present in the fibrous solid fraction, and d. obtaining a fibrous solid substrate comprising organic and inorganic nitrogen parts having a reduced content of volatile nitrogen-containing compounds, e. providing fungal cells and/or spores, f. contacting the fungal cells and/or spores with the fibrous solid substrate, g. cultivating the fungal cells and/or spores in said substrate, and h. optionally obtaining a spent fungal substrate. a. providing a biomass material comprising solid and liquid parts from a biogas fermenter following an anaerobic fermentation and biogas production, b. subjecting the fermented biomass material of step a) to one or more separation steps resulting in the provision of i) a fibrous solid fraction comprising organic and inorganic nitrogen parts, and having a reduced content (w/w) of water, and comprising one or more macromolecular nutrient constituents selected from the group consisting of cellulose, hemicellulose, lignin and lignocellulose, and ii) at least one liquid fraction comprising solid and liquid organic and inorganic phosphor-containing parts, i) a fibrous solid fraction comprising organic and inorganic nitrogen parts, and having a reduced content (w/w) of water, and comprising one or more macromolecular nutrient constituents selected from the group consisting of cellulose, hemicellulose, lignin and lignocellulose, and ii) at least one liquid fraction comprising solid and liquid organic and inorganic phosphor-containing parts, c. subjecting the fibrous solid fraction of step b) to a sanitation and N-stripping treatment comprising the steps of i) heating the fibrous solid fraction to a temperature of more than 70°C, optionally under alkaline pH conditions, and optionally ii) subjecting the fibrous solid fraction comprising organic and inorganic nitrogen parts to a pressure of more than 1 bar, wherein said treatment i) reduces or eliminates viable microorganisms present in the fibrous solid fraction, and ii) reduces the contents of volatile nitrogen-containing compounds and/or precursor volatile compounds present in the fibrous solid fraction, and d. obtaining a fibrous solid substrate comprising organic and inorganic nitrogen parts having a reduced content of volatile nitrogen-containing compounds, e. providing fungal cells and/or spores, f. contacting the fungal cells and/or spores with the fibrous solid substrate, g. cultivating the fungal cells and/or spores in said substrate, and h. optionally obtaining a spent fungal substrate.