The FBI was forced to move before it was ready against two men accused of impersonating federal agents after a Secret Service investigator for unclear reasons tipped off the pair that they were under scrutiny, a federal prosecutor said on Tuesday.

Arian Taherzadeh, 40, and Haider Ali, 35, were arrested last week and are accused of providing gifts worth thousands of dollars such as rent-free apartments and iPhones to Secret Service agents, including one who protected first lady Jill Biden. The Secret Service is the agency responsible for protecting the president and other top U.S. officials.

In a hearing in federal court in Washington, prosecutor Joshua Rothstein said the tip-off occurred on April 4 after the Secret Service launched an internal inquiry and placed four of its agents on administrative leave for accepting gifts from Taherzadeh and Ali.

"An investigator, as part of that internal investigation, reached out to Mr. Taherzadeh via email ... saying that he needed to get information, and Mr. Taherzadeh responded," Rothstein told the court. "He didn't say the nature of the investigation. He just said that he was a United States Secret Service official and that he was conducting some sort of review. And so that is what then tipped him off."

Rothstein did not explain why the Secret Service investigator informed Taherzadeh about the inquiry. There was no indication that the tip-off was intended to protect the suspects, but it adds another wrinkle to a case that has brought the Secret Service under scrutiny.

The tip-off prompted the Justice Department to rush the next day for the court's approval for a warrant that preceded the arrests last Wednesday on charges that the two men impersonated U.S. Department of Homeland Security agents.

A Secret Service spokesperson did not immediately respond to a request for comment.

Prosecutors have said the two men pose a danger to the community and should be jailed pending trial. Tuesday marked the third day of their detention hearings. Their attorneys have said the evidence suggesting they are dangerous is flimsy.

U.S. Magistrate Judge Michael Harvey on Tuesday expressed some skepticism at the government's request to keep them jailed.

"You have not proffered any evidence that these gentlemen bribed anyone," Harvey told Rothstein.

"It is under investigation," Rothstein said.

Harvey is due to make a decision on detention later on Tuesday.