Mayor de Blasio met with federal prosecutors Friday in connection with their investigation into whether the mayor and his aides traded government favors for donations.

NBC 4 New York first reported earlier this month that U.S. Attorney Preet Bharara's office had asked the mayor to come in and answer questions, and that de Blasio agreed, according to sources. The mayor acknowledged in a testy news conference that not only is he now raising money for re-election, he'd need to raise money to pay his legal fees.

The four-hour meeting with prosecutors from the U.S. Attorney's Public Corruption Unit took place at the law offices of Kramer Levin.

All discussed whether the mayor or his team broke any laws when raising funds back in 2013, and whether donors like Harendra Singh - the proprietors of Queens restaurant the Water's Edge - got any special benefit from the administration.

De Blasio has long insisted that his fundraising followed the law.

"We remain confident that at all times the Mayor and his staff acted appropriately and well within law. We hope our continued cooperation will help bring a swift conclusion to the U.S. Attorney's review," City Hall Spokesman Eric Phillips said in a statement. "In the interest of protecting the integrity of this process, we will refrain from any further comment at this time."

The U.S. attorney's office also declined to comment.

De Blasio's criminal defense lawyer, Barry Berke, already had at least one meeting of his own with prosecutors in an attempt to convince them not to press charges, sources told NBC 4.

"We are very careful about doing things in a legal and appropriate manner," the mayor previously told NBC 4 New York. "We're very careful about disclosing the support we get."

The meeting with federal prosecutors comes after the mayor met with the Manhattan district attorney's office. Prosecutors there are apparently wrapping up a separate criminal investigation into whether anyone at City Hall crossed any lines in helping raise money to try to help Democrats take control of the state Senate.

De Blasio said he hasn't been informed that he's the target of an investigation in that case.

However, the federal probe could be winding down. Former federal prosecutor Brad Simon told News 4 the mayor likely signed what's called a proffer agreement today, and that the questions were likely part of a courteous interview to gain information from what could be the last person interviewed.

"He's not gonna be the first stop, he's gonna be the last stop," Simon said. "They sign a piece of paper. Nothing can be used against him. Like any interview, if he lies, he can be charged. Even if he's under oath."