A 20-year-old Maryland man assaulted a Secret Service officer outside the White House while shouting 'Where is the president?' shortly after a major immigration rally on Saturday, according to federal authorities.

Steven Carmona, of Wheaton, allegedly punched the uniformed officer in the jaw and above his right eye after he was told to move his parked car from a sidewalk in front of the building.

Carmona was charged with assaulting a federal agent and released from jail on Tuesday. He must now attend drug tests and stay away from four blocks around the White House.

Steven Carmona allegedly punched the uniformed officer in the jaw and above his right eye after he was told to move his parked car from a sidewalk in front of the White House (file photo)

Carmona parked his gray BMW 300i on the sidewalk at 3.30pm after moving plastic blocks that had been set up for The Families That Belong Together Rally, according to an affidavit NBC Washington.

The officer came over to ask Carmona not to park his car illegally, prompting Carmona to square up to him in an aggressive manner.

Carmona then allegedly punched the officer twice before he was taken down by two other officers, who put the suspect in leg irons to stop him kicking out.

The first officer suffered a knee injury and possible concussion.

'Carmona was placed under arrest for assaulting a federal law enforcement officer. While being placed under arrest, Carmona asked ''Where is the President?'' He also stated to officers ''Just end it, just kill me,''' the affidavit says.

He was put in a prisoner transport van but transferred to an ambulance after he began headbutting the walls.

Carmona parked his gray BMW 300i on the sidewalk at 3.30pm after moving plastic blocks that had been set up for The Families That Belong Together Rally (pictured on June 30)

The suspect then spat at officers and medics so was strapped onto a stretcher to restrain his movement.

The Families Belong Together Rally saw 30,000 protesters gather to watch speakers calling on the Trump administration to ensure children separated from their parents at the border are reunited with their parents.

It is unclear whether Carmona attended the rally, which took place shortly before he was arrested.