Melatonin is primarily metabolized in the liver by cytochrome P450 enzymes, especially CYP1A2. This metabolic pathway suggests that factors affecting liver function or enzyme activity could influence melatonin's pharmacokinetics. Understanding these pathways is crucial when considering melatonin in individuals with liver impairments or those taking other drugs that are metabolized by the same enzymes.