NEW YORK — Federal agents executed a search warrant Wednesday at the Manhattan home and law offices of Rudolph W. Giuliani, seizing his electronic devices as part of a long-running criminal investigation into whether the onetime New York mayor and attorney for former president Donald Trump acted as an unregistered foreign agent.

For Giuliani, who once served as the U.S. attorney for Manhattan, the very office now investigating him, the search warrant is another sign of how far removed he has become from the decades when he was best known as a crusading crime-buster, decapitating the mafia and consoling the country in the wake of the Sept. 11, 2001, terrorist attacks.

It also marks the latest sign that even after Trump’s departure from the White House, investigations into possible wrongdoing before and during his time in office continue to churn, as local and federal authorities probe members of the former president’s inner circle.

The investigation into Giuliani revolves around his interactions with Ukrainian figures at the same time he was serving as Trump’s lawyer. Ahead of last year’s presidential election, Giuliani sought information that might prove politically damaging to then-candidate Joe Biden and pressed for the ouster of the U.S. ambassador to Ukraine. The episode factored prominently in Trump’s first impeachment, but Justice Department leaders had resisted approving a search warrant late in his administration.

Rudy Giuliani set out to Ukraine to vindicate the president. Instead, he helped set an impeachment scandal in motion. (Jon Gerberg, Dalton Bennett/The Washington Post)

Robert Costello, a lawyer for Giuliani, issued a lengthy statement saying that while the Justice Department may have the former mayor’s phone and computer, they do not have a viable case against him. Costello said that authorities had ignored potential criminal violations by President Biden’s son Hunter and focused instead on one of the Biden family’s most vociferous critics.

“The search warrants involve only one indication of an alleged incident of failure to register as a foreign agent,” Costello said. “Mayor Giuliani has not only denied this allegation, but offered twice in the past two years . . . to demonstrate that it is entirely untrue. Twice the offer was rejected” by prosecutors.

Costello said the search warrant, the existence of which was first reported Wednesday by the New York Times, shows the Justice Department has a “double standard” when it comes to allegations of corruption surrounding Trump and such allegations against Democrats. Separately, the U.S. attorney in Delaware has been conducting an investigation into Hunter Biden’s finances, according to people familiar with the matter.

Trump and Giuliani have stayed in touch since the former president left office, and Giuliani was spotted at his Mar-a-Lago Club in Florida one weekend evening earlier this month, according to a person present at the club. A spokesman for Trump did not reply to a request for comment.

Also on Wednesday, FBI agents served a search warrant for the phone of Washington-area lawyer Victoria Toensing, according to a person familiar with the matter who, like others, spoke on the condition of anonymity to discuss a sensitive subject. Toensing, a Trump ally who also did work involving key figures in Ukraine, denied wrongdoing.

In a statement noting Toensing’s past work as a federal prosecutor and Justice Department official, her law firm said that she was told she is not a target of the investigation, adding that Toensing “has always conducted herself and her law practice according to the highest legal and ethical standards. She would have been happy to turn over any relevant documents. All they had to do was ask.”

Two of Giuliani’s associates, Lev Parnas and Igor Fruman, were charged with campaign-finance violations in 2019. Both men, Soviet-born emigres who aided Giuliani’s efforts to look for political dirt on Joe Biden, have pleaded not guilty in the case brought by federal prosecutors in New York. Joseph Bondy, an attorney for Parnas, declined to comment on the development in Giuliani’s case. Fruman’s lawyer Todd Blanche also declined to comment. 

Parnas and David Correia, another defendant originally charged in the alleged campaign-finance scheme, were indicted on additional charges in September. Prosecutors have accused them of defrauding at least seven investors in Fraud Guarantee, a defunct insurance start-up for which they raised more than $2 million in investments, saying it was not a functional entity. Giuliani was hired as a consultant for Fraud Guarantee and paid $500,000 in October 2018, according to court papers, which do not identify him by name.

Correia has pleaded guilty for his role in the corporate “risk management” scam and was sentenced in February to a year in prison. All charges are still pending against Parnas, who has pleaded not guilty.

For much of 2019 and 2020, Giuliani was a source of great consternation within the Justice Department, as officials questioned whether he was acting at times on behalf of Trump or on behalf of Ukrainian interests, according to former officials.

Wanting to distance the department from the president’s personal lawyer while Giuliani was enmeshed in a criminal investigation, then-Attorney General William P. Barr set up a separate channel for Giuliani to offer authorities information about Biden and his family.

At the time, Trump and Giuliani were urging the Ukrainian government to investigate Biden and his son Hunter, who worked on the board of a Ukrainian energy company while his father oversaw the Obama administration’s Ukraine policy. As part of that pressure campaign, Trump personally appealed to his Ukrainian counterpart in a July 2019 phone call, leading to the first of Trump’s two impeachments.

The Democratic-controlled House charged Trump with abuse of power and obstruction of Congress. He was later acquitted in the Republican-controlled Senate.

For more than two years, Giuliani wove back and forth between American and Ukrainian politics, trying to paint a portrait of Democratic officials engaged in corrupt bargains with Ukrainian leaders, often leading to criticism that he was the one engaged in an improper influence campaign.

Parnas and Fruman helped connect Giuliani with former Ukrainian officials who claimed it was their country rather than Russia that had interfered in the 2016 U.S. presidential election and that a Ukrainian government investigation into Hunter Biden had been quashed under questionable circumstances.

In so doing, Giuliani became a fierce critic of Marie Yovanovitch, then the U.S. ambassador to Ukraine.

One of Yovanovitch’s biggest adversaries was Yuri Lutsenko, Ukraine’s former prosecutor general. Giuliani met with Lutsenko in New York in 2019 to discuss the possibility that Ukraine would open a new investigation into the 2016 U.S. election or Burisma, the energy company whose board of directors included Hunter Biden.

Notes from Lutsenko’s meeting with Giuliani that were turned over to the State Department’s inspector general and submitted to lawmakers show that Lutsenko also discussed Yovanovitch.

Giuliani’s displeasure with Yovanovitch appears to have grown when State Department officials declined to issue a visa to another Ukrainian, former prosecutor Viktor Shokin, who wanted to travel to the United States to meet with him.

Trump recalled Yovanovitch from Ukraine in April 2019, as his pressure campaign for a Biden investigation ramped up. Her dismissal played a significant role in Trump’s impeachment hearings.

Barrett and Dawsey reported from Washington. Tom Hamburger, Rosalind S. Helderman and Matt Zapotosky in Washington contributed to this report.