The man accused of trying to make love to a BART train seat was rightfully convicted of lewd conduct, a state appeals court ruled Monday.

Although Leslie Bailey, 28, was acquitted of felony indecent exposure for the episode, a San Francisco jury found him guilty of misdemeanor lewd acts.

Bailey was arrested May 8, 2013 shortly after BART train operator Lori Hudson saw him on on his knees in the nearly empty first car, thrusting his pelvis against a seat next to the cab. He was described as wearing either red thong underwear or boxer shorts.

Bailey, who boarded the Dublin-Pleasanton train at the 16th Street station, exited at Civic Center but returned to the seat of his affections just before the doors closed. Hudson testified that she then saw him gyrating on his stomach, his feet in the aisle, before he flipped over and began masturbating and smoking crack cocaine.

Bailey never acknowledged the operator while in the throes of passion, but noticed her once he exited at the Powell Street station, the public defender’s office said. Hudson testified that while Bailey apologized to her for smoking, his genitals were peeking out from beneath his shirt.

BART police found him at the elevator at the station’s Muni level.

In a recording of the encounter that was captured on BART police Officer Jeffrey Zwetsloot’s collar-mounted camera, “Bailey denied masturbating and claimed to be by the elevator because it was a convenient place to urinate. There was, however, no urine on the floor,” Judge Steven Brick of Alameda County Superior Court wrote in the 3-0 ruling that found no arguable issues on appeal.

And although it wasn’t captured in the recording, Bailey’s member, still in its aroused state, was “still protruding through the bottom of his shirt” as Zwetsloot patted him down, Brick wrote.

Deputy Public Defender Emily Dahm, Bailey’s attorney, has said that her client had not been taking his anti-psychotic medication regularly and that he had been binging on crack cocaine.

She argued during the weeklong trial that Bailey, who is homeless, had been trying to have a private moment, not attract public attention. To convict someone of felony indecent exposure, prosecutors must prove that the defendant was seeking attention.

According to court records, Bailey was convicted of felony indecent exposure in 2007 in San Francisco.

This time, the jury acquitted Bailey of one count of indecent exposure, deadlocked on a second count and convicted him of misdemeanor lewd acts. Prosecutors dismissed the remaining felony charge.

Bailey was sentenced to time served and released.