“Cheap shot,” Mr. Giuliani exclaimed. (In court, Mrs. Giuliani had claimed that her husband spent $286,532 since their divorce commenced on Ms. Ryan. Mr. Giuliani denied having an affair.)

“It’s hard to be a client,” Mr. Giuliani told The New York Times in an interview earlier this year. “It is much easier to be a lawyer.”

That seems now a more prosaic time.

Since his divorce began last spring, Mr. Giuliani was revealed to have been the president’s point man in a rogue foreign policy effort designed to dig up incriminating information on Hunter Biden, the younger son of former Vice President Joseph R. Biden Jr., who was hired onto the board of a Ukrainian gas company.

Impeachment hearings also pointed to Mr. Giuliani’s efforts to remove the United States ambassador to Ukraine, Marie L. Yovanovitch, and his bid to force Ukraine’s new government to announce criminal investigations into the Biden family. Those efforts have helped usher the president to the brink of impeachment.

And two of Mr. Giuliani’s emissaries in his Ukraine efforts, Soviet-born American businessmen named Lev Parnas and Igor Fruman, were arrested on charges of making illegal campaign contributions.

Now Mr. Giuliani himself is under criminal investigation by federal prosecutors in the same office where four decades ago he was himself a star prosecutor.

Jeffrey R. Cohen, a divorce lawyer who has represented celebrities like Lou Reed and the singer Marc Anthony, said that the settlement was “great for her, and I think it is smart for him, he has enough problems.”