As Rudolph W. Giuliani waged a public campaign this year to unearth damaging information in Ukraine about President Trump’s political rivals, he privately pursued hundreds of thousands of dollars in business from Ukrainian government officials, documents reviewed by The New York Times show.

Mr. Giuliani, the president’s personal lawyer, has repeatedly said he has no business in Ukraine, and none of the deals were finalized. But the documents indicate that while he was pushing Mr. Trump’s agenda with Ukrainian officials eager for support from the United States, Mr. Giuliani also explored financial agreements with members of the same government.

His discussions with Ukrainian officials, including the country’s top prosecutor, who assisted him on the dirt-digging mission, proceeded far enough along that he signed at least one retainer agreement, on his company letterhead.

In an interview on Wednesday, Mr. Giuliani played down the discussions. He said that a Ukrainian official approached him this year seeking to hire him personally. Mr. Giuliani said he dismissed that suggestion, but spent about a month considering a separate deal with the Ukrainian government. He then rejected that idea.