WASHINGTON - Federal prosecutors in New York City are investigating whether President Donald Trump’s personal lawyer Rudy Giuliani broke lobbying laws in his dealings in Ukraine, according to two people familiar with the inquiry.

The investigators are examining Giuliani’s efforts to undermine the U.S. ambassador to Ukraine, Marie L. Yovanovitch, one of the people said. She was recalled in the spring as part of Trump’s broader campaign to pressure Ukraine into helping his political prospects.

The investigation into Giuliani is tied to the case against two of his associates who were arrested this week on campaign finance-related charges, the people familiar with the inquiry said. The associates were charged with funneling illegal contributions to a congressman whose help they sought in removing Yovanovitch.

Giuliani has denied wrongdoing, but he acknowledged that he and the associates worked with Ukrainian prosecutors to collect potentially damaging information about Yovanovitch and other targets of Trump and his allies, including former Vice President Joe Biden and his son Hunter Biden. Giuliani shared that material this year with U.S. government officials and a Trump-friendly columnist in an effort to undermine the ambassador and other Trump targets.

Federal law requires U.S. citizens to disclose to the Justice Department any contacts with the government or media in the United States at the direction or request of foreign politicians or government officials, regardless of whether they pay for the representation. Law enforcement officials have made clear in recent years that covert foreign influence is as great a threat to the country as spies trying to steal government secrets.

A criminal investigation of Giuliani raises the stakes of the Ukraine scandal for the president, whose dealings with the country are already the subject of an impeachment inquiry. It is also a stark turn for Giuliani, who now finds himself under scrutiny from the same U.S. attorney’s office he led in the 1980s, when he first rose to prominence as a tough-on-crime prosecutor and later ascended to two terms as mayor of New York.

It was unclear how far the investigation has progressed, and there was no indication that prosecutors in Manhattan have decided to file additional charges in the case. A spokeswoman for the U.S. attorney in Manhattan, Geoffrey S. Berman, declined to comment.

Giuliani said that federal prosecutors had no grounds to charge him with foreign lobbying disclosure violations because he said he was acting on behalf of Trump, not the Ukrainian prosecutor, Yuriy Lutsenko, when he collected the information on Yovanovitch and the others and relayed it to the U.S. government and the news media.

“Look, you can try to contort anything into anything, but if they have any degree of objectivity or fairness, it would be kind of ridiculous to say I was doing it on Lutsenko’s behalf when I was representing the president of the United States,” Giuliani said. Lutsenko had chafed at Yovanovitch’s anticorruption efforts and wanted her recalled from Kyiv.

Giuliani also said he was unaware of any investigation into him, and he defended the pressure campaign on Ukrainians, which he led, as legal and above board.

CNN and other news organizations reported that federal prosecutors were scrutinizing Giuliani’s financial dealings with his associates, but it has not been previously reported that federal prosecutors in Manhattan are specifically investigating whether he violated foreign lobbying laws in his work in Ukraine.

Yovanovitch told impeachment investigators Friday that Trump had pressed for her removal for months even though the State Department believed she had “done nothing wrong.”

Giuliani had receded from the spotlight in recent years while he built a brisk international consulting business, including work in Ukraine. But he reemerged in the center of the political stage last year, when Trump retained him for the special counsel’s investigation into Russian election interference.

Russia’s sabotage also ushered in a new focus at the Justice Department on enforcing the laws regulating foreign influence that had essentially sat dormant for a half-century and under which Giuliani is now being investigated.

Giuliani said that because Democrats had questioned his business consulting for foreign clients, his contracts explicitly say he does not lobby or act as an agent of foreigners.

Through his two associates who also worked to oust the ambassador, Lev Parnas and Igor Fruman, Giuliani connected early this year with Lutsenko, who served as Ukraine’s top prosecutor until August. Parnas and Fruman had previously connected Giuliani to Lutsenko’s predecessor, Viktor Shokin, late last year.

Parnas had told people that Yovanovitch was stymieing his efforts to pursue gas business in Ukraine. Parnas also told people that one of his companies had paid Giuliani hundreds of thousands of dollars for an unrelated U.S. business venture, and Giuliani said he advised Parnas and Fruman on a Ukrainian dispute.

Lutsenko had sought to relay the information he had collected on Trump’s targets to U.S. law enforcement agencies and saw Giuliani as someone who could make that happen. Giuliani and Lutsenko initially spoke over the phone and then met in person in New York in January.

Lutsenko initially asked Giuliani to represent him, according to the former mayor, who said he declined because it would have posed a conflict with his work for the president. Instead, Giuliani said, he interviewed Lutsenko for hours, then had one of his employees — a “professional investigator who works for my company” — write memos detailing the Ukrainian prosecutors’ claims about Yovanovitch, Biden and others.

Giuliani said he provided those memos to Secretary of State Mike Pompeo this year and was told that the State Department passed the memos to the FBI. He did not say who told him.

Giuliani said he also gave the memos to the columnist, John Solomon, who worked at the time for the Hill newspaper and published articles and videos critical of Yovanovitch, the Bidens and other Trump targets. It was unclear to what degree Giuliani’s memos served as fodder for Solomon, who independently interviewed Lutsenko and other sources.

Solomon did not immediately respond to a request for comment.

The lobbying disclosure law contains an exemption for legal work, and Giuliani said his efforts to unearth information and push both for investigations in Ukraine and for news coverage of his findings originated with his defense of Trump in the special counsel’s investigation.

He acknowledged that his work morphed into a more general dragnet for dirt on Trump’s targets but said that it was difficult to separate those lines of inquiry from his original mission of discrediting the origins of the special counsel’s investigation.

Giuliani said Lutsenko never specifically asked him to try to force Yovanovitch’s recall, saying he concluded himself that Lutsenko probably wanted her fired because he had complained that she was stifling his investigations.

“He didn’t say to me, ‘I came here to get Yovanovitch fired.’ He came here because he said he had been trying to transmit this information to your government for the past year, and had been unable to do it,” Giuliani said of his meeting in New York with Lutsenko. “I transmitted the information to the right people.”

The president sought to distance himself earlier Friday from Giuliani, saying he was uncertain when asked whether Giuliani still represented him. “I haven’t spoken to Rudy,” Trump told reporters. “I spoke to him yesterday quickly. He is a very good attorney, and he has been my attorney.”

Giuliani later said that he still represented Trump.

The recall of the ambassador and the efforts by Trump and Giuliani to push for investigations in Ukraine have emerged as the focus of House Democrats’ impeachment inquiry into Trump.

The impeachment was prompted by a whistleblower complaint about Trump pressing President Volodymyr Zelenskiy of Ukraine in a July phone call to pursue investigations that could help Trump’s 2020 reelection campaign. At the time, the Trump administration had frozen $391 million in military assistance to Ukraine for its fight against Russian-backed separatists.

The State Department’s inspector general has turned over to House impeachment investigators a packet of materials including the memos containing notes of Giuliani’s interviews with Lutsenko and Shokin.

The investigation into Giuliani is the latest to scrutinize one of Trump’s lawyers. His former personal lawyer and fixer, Michael Cohen, implicated the president when he pleaded guilty last year to making hush payments during the 2016 campaign to women who claimed affairs with Trump, which he has denied.

Federal prosecutors in Manhattan mentioned Trump as “Individual 1” in court papers but never formally accused him of wrongdoing.