Prosecutors said Tuesday that two men facing charges for allegedly posing as federal agents were inadvertently tipped off about the federal investigation into their activities by an investigator at the U.S. Secret Service.

Arian Taherzadeh and Haider Ali figured out they were under investigation, government lawyers said, when the Secret Service investigator reached out to Taherzadeh's business email about an "internal investigation" at the Secret Service.

TWO MEN POSED AS FEDERAL AGENTS, PROVIDED SECRET SERVICE OFFICERS WITH IPHONES, APARTMENT, OFFICIALS ALLEGE

Attorneys told Magistrate Judge G. Michael Harvey during a detention hearing on Tuesday that the slip up caused the Secret Service to speed up their process and arrest the men earlier than they might have otherwise.

The government accuses the two men of impersonating federal agents, and providing gifts to Secret Service agents, at least one of whom worked on the detail of the first lady. Other agents worked at the vice president’s residence and the White House, according to government prosecutors.

Taherzadeh Vest

In an attempt to prove he was an employee of the Department of Homeland Security, Taherzadeh took a picture of himself in a DHS investigations "vest." The Secret Service agent also allegedly saw multiple pictures of Taherzadeh in police tactical gear, according to prosecutors. (Department of Justice)

DC MEN WHO ALLEGEDLY POSED AS FEDERAL AGENTS UNDER SCRUTINY FOR POSSIBLE FOREIGN TIES

Government lawyers say both men are flight risks if released. They point to Ali’s travels to Pakistan, Iran, Egypt and Iraq. They also say he has some kind of status in Pakistan, as he has a Pakistani Visitor ID card. Ali’s lawyer says he is not a citizen of Pakistan and would need the passport already confiscated by the U.S. government to travel outside the country. 

Ali’s lawyer said his client would not leave his wife and young children, while lawyers for both men point out this is their first offense and they would likely only face a few months in prison, and therefore wouldn’t risk fleeing their home country.

CLICK HERE TO GET THE FOX NEWS APP

Judge Harvey explored the idea of releasing the men pending trial and lawyers for both said they could stay with family members in Virginia. Taherzadeh’s father said he would quit his job to watch over his son. Ali’s parents also live in Virginia and told the court they could take care of their son and his family.

Harvey has yet to decide whether the men will be held pending trial, but he told both sides he will rule on the issue Tuesday at 4 p.m.