A man was struck and killed by a Muni train at Bayshore Boulevard and Sunnydale Avenue in San Francisco’s Visitacion Valley early Sunday, the San Francisco Municipal Transportation Agency said.

The train was waiting for the light at its final stop before going to the Muni yard for the night when a person on the platform approached at around 1:15 a.m. and attempted to open its doors, the agency said in a statement.

The individual then climbed over the train’s safety straps and sat on the coupler that connects two train cars. When the operator headed toward the Muni yard, the man fell off and was struck by a train car, the agency said.

The train operator was unaware that the man was struck by the train car, the agency said. Another operator called to report the man’s body on the tracks. The scene was cleared by about 7 a.m. San Francisco police and Muni Systems Safety are investigating the incident.

Tatiana Sanchez is a San Francisco Chronicle staff writer. Email: tatiana.sanchez@sfchronicle.com Twitter: @TatianaYSanchez.