President Trump’s personal lawyer, Rudolph W. Giuliani, said on Wednesday that he had assembled a legal team to represent him in the criminal investigation into his activities related to Ukraine, an announcement that came after weeks of sputtered attempts to find a lawyer willing to take him on as a client.

Mr. Giuliani said on Twitter that he would be represented by three lawyers, including his longtime friend, Robert J. Costello. The hires show how seriously Mr. Giuliani is treating the inquiry by federal prosectors in Manhattan, who are investigating whether he violated lobbying laws in his efforts to dig up damaging information about Mr. Trump’s rivals.

“The evidence, when revealed fully, will show that this present farce is as much a frame-up and hoax as Russian collusion, maybe worse, and will prove the President is innocent,” Mr. Giuliani said on Twitter, just before naming his new lawyers.

The hires came after a weekslong search to find a lawyer who would represent Mr. Giuliani, who rose to prominence as the United States attorney for the Southern District of New York, the same office that is now investigating him. He has a wide range of close associates — including former prosecutors and judges — who could have taken him on as a client.