The aim was to isolate, identify and characterize endophytes from Solanum nigrum L. as a new source of the cytotoxic steroidal alkaloid solamargine. Three endophytic fungi; SNFSt, SNFL and SNFF were isolated from S. nigrum and identified by molecular methods. Preliminary TLC screening showed a common metabolite between the plant and one of these fungi, SNFSt which was identified as Aspergillus flavus based on the phylogenetic analysis of its ITS sequence. Subsequent LC-HRESIMS analysis unambiguously established the identity of the compound based on its molecular formula and its characteristic MS(2) fragmentation pattern as solamargine. To ascertain its identity, fungal solamargine was isolated using preparative TLC and its structure was fully characterized using NMR spectroscopic techniques and high-resolution mass spectrometric analysis. Solamargine production could be followed and quantified for a total of 11 generations of this fungus with a titer of ~250-300 μg l(-1) . This study represents one of the first examples where host plant-derived compounds have been demonstrated to be steadily produced by an endophytic fungi in sizeable quantities. The production of solamargine (found in the host plant) by a cultivable fungal endophyte at a significant yield is a new observation. Further experiments such as media optimization, OSMAC (One Strain Many Compounds) or epigenetic modifiers could be applied to enhance the fungal solamargine production. The endophytic fungus SNFSt isolated from S. nigrum may be utilized for quantitative production of the potent cytotoxic metabolite solamargine.