A California man was detained by transit police for eating a breakfast sandwich on a train platform last week — a violation of state law that ended with the man being handcuffed and given a citation.

Steve Foster, 31, was on a Bay Area Rapid Transit platform near Contra Costa Centre, heading to work around 8 a.m. on Nov. 4, when the transit officer, identified as D. McCormick in videos posted online, stopped him, telling him he was breaking the law.

BART SUPERVISOR HAILED A HERO AFTER PULLING MAN FROM ONCOMING TRAIN AT STATION

"You are detained and you're not free to go," the officer says in the video, telling him that eating on a BART train or platform is "a violation of California law."

Foster accuses the police officer of singling him out among other people on the platform. McCormick then grabs Foster's backpack and threatens to send him to jail.

WARNING: GRAPHIC LANGUAGE BELOW

"I'm not going to jail for eating a f------ sandwich," Foster tells him, demanding he release his backpack.

"No, for resisting arrest," the officer replies.

MINIATURE HORSE RIDES SAN FRANCISCO BART TRAIN

The man and a woman filming the video question why there is a store near the platform that sells food, and why there aren't any signs indicating that eating on the platform is illegal. An officer tells the woman in a separate video that there are such signs.

Three other officers arrive and one forcibly turns Foster around as the officers handcuff him. Foster is escorted off the platform in cuffs and taken to a private room. One of the officers tells Foster he's being held because he matches the description of someone who was creating a disturbance on the platform.

"Eating on BART is a violation of California law whether you like it or not," McCormick tells Foster at one point. In a separate video posted online, McCormick tells the woman filming that he was on the platform looking for a possibly intoxicated woman, whom he never found, before he spotted Foster eating food.

Alicia Trost, communications director for BART, told Fox News on Monday the California law in question is PC 640 (b) (1): "Eating or drinking in or on a system facility or vehicle in areas where those activities are prohibited by that system."

SAN FRANCISCO BART STATIONS FEATURE ADS FROM HOLOCAUST DENIAL GROUP

She said Foster was not arrested following the incident but was issued a citation for "eating inside our paid area which is a violation of state law." Trost said Foster was "lawfully handcuffed when he refused to provide his identification."

BART's general manager, Bob Powers, said in a statement on Monday that there are "multiple signs inside every station" indicating that eating is banned from paid areas. Powers said McCormick was on another call when he asked Foster to stop eating. When he passed by again and still saw Foster eating, the confrontation ensued.

"The individual refused to provide identification, cursed at and made homophobic slurs at the officer who remained calm throughout the entire engagement," Powers said, adding the officer was just doing his job, but noted that "context is key" and he was "disappointed [with] how the situation unfolded."

Powers said BART's Independent Police Auditor is conducting an investigation.

CLICK HERE TO GET THE FOX NEWS APP

Foster described the incident to KTVU as "childish," and said he's "never had anything like that happen to me before." He told the news station he believes he was singled out because of his race.

Foster reportedly faces a $250 fine and 48 hours of community service for his citation.