A man who was dishonorably discharged from the Marines after a sex crimes conviction got past two security checkpoints at a Florida airport — around the time President Trump was set to depart, federal prosecutors said Monday.

Brandon Mark Magnan, 37, showed up at Palm Beach International Airport on Sunday and claimed he was working security on Marine One, the helicopter that transports the commander-in-chief, according to a criminal complaint.

Magnan allegedly flashed credentials with faux Marine Corps seals and was able to get onto the grounds of Atlantic Aviation, where both Marine One and Air Force One are housed while Trump stays at his Mar-a-Lago club in Palm Beach.

But an eagle-eyed Palm Beach County sheriff’s deputy noticed Magnan wasn’t in a Marine Corps uniform, as is standard for presidential travel, and alerted authorities, the complaint states.

When confronted, Magnan allegedly claimed to be retired.

The Secret Service soon figured out that Magnan had been dishonorably discharged in 2010, “following his conviction at a Court Martial for serious offenses,” the complaint states.

He was convicted of charges that included abusive sexual conduct and forced sodomy, according to the Palm Beach Post. He has been a registered sex offender since.

Magnan eventually admitted to having been dishonorably discharged, according to the complaint.

He was charged with false impersonation of an officer or employee of the United States, and faces a maximum of three years in prison and a $250,000 fine if convicted.

He was released on a $100,000 bond Monday. His next court hearing is scheduled for Jan. 27.