Heroin is a semi-synthetic opioid synthesized from morphine, which is a natural alkaloid extracted from the sap (latex) of the opium poppy plant (Papaver somniferum).