A Drug Enforcement Administration special agent trespassed with his government-issued firearm on the Capitol grounds Jan. 6 and then lied about his actions, according to federal prosecutors.

Mark Ibrahim, who was arrested Tuesday, is not accused of entering the Capitol building. Prosecutors say he entered the restricted grounds around the building shortly after barricades were torn down by the mob and then repeatedly showed off his badge and gun to other protesters. He then falsely claimed he was there to help the FBI, prosecutors say.

According to the court record, Ibrahim, of Orange County, Calif., arrived at the Capitol just after 1 p.m. Jan. 6 and was there when the barricades around the building were torn down. He appears in several photographs inside the collapsed barricades, near the Senate steps. About 3 p.m., he filmed a video of himself on the Peace Monument outside the building. Ibrahim took personal leave to attend the Jan. 6 rally, the government said. He was released Tuesday until a hearing in September.

In a voluntary interview, according to the government, Ibrahim told an agent for the Justice Department’s Office of the Inspector General that he went to the Capitol to assist a friend who was documenting the event for the FBI. The friend told the IG agent that he was not there in any formal capacity for the FBI and that Ibrahim had concocted the story, according to court records.

According to the friend, Ibrahim went to the Capitol to promote a podcast and cigar brand he planned to launch after leaving the DEA.

A spokeswoman for the DEA said Ibrahim is no longer employed there.

“DEA takes seriously our commitment to protecting the safety of the communities we serve,” she said. “Any employee who violates the law or internal DEA policies will be held accountable.”

Ibrahim was a probationary DEA employee and had given notice of his intention to resign several weeks before Jan. 6, according to prosecutors. He has said he was suspended and then fired, protesting the punishment through an attorney.

“Mr. Ibrahim was not part of, affiliated with nor participatory in any trespass or violent acts and vehemently denounces them. Those participants comprised only a fraction of the total attendees,” Ibrahim attorney Darren Richie wrote in March.

In an interview on Fox News in March, Ibrahim said he attended the rally with his brother, an FBI special agent.

“They got it wrong,” Ibrahim said. He said a friend he served with in Iraq asked him to help “document everything” and said he handed footage over to the FBI “so those criminals could face justice.”

Attorney Darren Richie said the case against Ibrahim “ results from conjecture, political pressure and a flawed attempt to paint a specific narrative through pictures taken wholly out of context” and that he “looks forward to vigorously defending himself against every charge.”

Ibrahim appears to be one of the first, if not the first, federal law enforcement agents accused of involvement in the Jan. 6 riot; at least 21 current or former local law enforcement officers have been charged with crimes.

On Tuesday, another veteran accused of participation in the events of Jan. 6 was held in jail pending trial, as Magistrate Judge G. Michael Harvey ruled that former Army Ranger Robert Morss was too dangerous to release.

Morss, prosecutors say, fought police outside the Capitol for over two hours before entering the building through a broken window. He wore body armor and carried a knife, according to court records.

The substitute social studies teacher from Shaner, Pa., and Afghanistan veteran, Harvey said, had “military training and experience, and willingness to use it in the apparent service of political violence.” Citing videos in which Morss directed others to use riot shields against police, he said, “In the middle of all that melee, he was in his element — he was calm, confident, ready, bold. All things that you might expect from a former Army Ranger with battlefield experience.”

Spencer S. Hsu contributed to this report.