When Rudy Giuliani met with a top aide to Ukraine’s president last summer, he discussed the prospect of a coveted White House meeting while seeking Ukraine’s commitment to certain investigations that could benefit Donald Trump politically.

Mr Giuliani also threw in a request of his own: help the mayor of Kiev keep his job.

The mayor, Vitaliy Klitschko, a professional boxer turned politician and longtime friend and former client of Mr Giuliani’s, was on the verge of being fired from his duties overseeing Kyiv’s $2 billion (£1.5bn) budget.

Firing Mr Klitschko would have fit with President Volodymyr Zelenskiy’s campaign promise to fight Ukraine’s entrenched interests and allowed him to replace a political adversary with a loyalist in one of the country’s most important posts.

But despite the fact that Mr Zelenskiy’s cabinet approved Mr Klitschko’s removal, he remains there today, leaving his adversaries in the murky and lucrative world of Ukrainian municipal politics to wonder whether Mr Trump’s personal attorney may have tipped the scales in his favour.

All the president's lawyers: The team fighting Trump's impeachment Show all 6 1 /6 All the president's lawyers: The team fighting Trump's impeachment All the president's lawyers: The team fighting Trump's impeachment Alan Dershowitz Dershowitz is a controversial American lawyer best known for the high-profile clients he has successfully defended. Those clients have included OJ Simpson, Jeffrey Epstein and Harvey Weinstein. One longtime Harvard Law associated told the New Yorker Dershowitz "revels in taking positions that ultimately are not just controversial but pretty close to indefensible." Getty All the president's lawyers: The team fighting Trump's impeachment Ken Starr Starr became a household name in the 1990s as the independent counsel who led the investigation that led to Bill Clinton's impeachment. That investigation began as a look into a real estate scandal known as Whitewater, and eventually led to impeachment after Mr Clinton lied under oath about having an affair with White House intern Monica Lewinsky. AP All the president's lawyers: The team fighting Trump's impeachment Jay Sekulow Sekulow is the president's longtime personal attorney, and, now, personal lawyer in the White House. He has been accused by former Rudy Giuliani associate Lev Parnas of being "in the loop" during the Ukraine scandal. Getty All the president's lawyers: The team fighting Trump's impeachment Pam Bondi Bondi is the former attorney general in Florida, and a longtime backer of the president's. She made a name for herself in Florida for taking hyper partisan stances on issues, and her penchant for publicity. She is likely to be a prominent public-facing figure during the trial. AFP/Getty All the president's lawyers: The team fighting Trump's impeachment Pat Cipollone Cipollone is the White House counsel, and leading the president's defence team. Getty All the president's lawyers: The team fighting Trump's impeachment Rudy Giuliani While not officially named as one of the president's impeachment lawyers, it is hard to ignore Giuliani's outsized role in this process. The former mayor of New York has been making headlines for months as he defends his client, and for his apparent role in the effort to compel Ukraine to launch the investigation into Joe Biden. We'll see how he figures in the actual trial, which he has said he would like to be a part of. Reuters

"The coincidence in timing between Klitschko’s meeting with Giuliani and the developments in the governance of Kiev was striking,” said Oleksandr Tkachenko, a member of the Ukrainian Parliament whom Mr Zelenskiy had been expected to nominate as Mr Klitschko’s replacement.

Mr Giuliani’s effort to help his friend and former client, first reported in The Washington Post, shed fresh light on the former New York mayor’s mingling of personal, business and political interests with his role as personal attorney to the president of the US.

In an interview with The New York Times, Mr Giuliani acknowledged discussing Mr Klitschko’s position in a meeting with a senior aide to Mr Zelenskiy, Andriy Yermak, in Madrid on 2 August.

“I said, ‘I don’t know, I’m from the outside, but he seems like one of the good guys',” Mr Giuliani said, recalling the conversation. “And I’m speaking, speaking, speaking as a personal friend, not as a representative of the government or anything else.”

In the same meeting, Mr Giuliani discussed a possible Oval Office visit by Mr Zelenskiy that the Ukrainian president had been seeking. Mr Giuliani asked for a commitment by his government to pursue investigations into former vice-president Joe Biden, his son and Ukrainians who disseminated damaging information about Mr Trump’s 2016 campaign.

The meeting took place at a time when Ukraine’s new president was looking to cement support from the US, his country’s most powerful ally in the conflict against Russia, and to build a relationship with Mr Trump.

Mr Giuliani said that he made it clear he was relating his personal view of Mr Klitschko, not that of the administration.

“I gave it as my opinion — not the government — and based on our personal relationships,” he said.

Mr Yermak also acknowledged the two discussed Mr Klitschko’s fate.

“Giuliani asked for my opinion about Vitaliy Klitschko as a mayor,” Mr Yermak said in a statement in response to an inquiry from The New York Times. “He immediately issued the disclaimer that I should not see his question as an attempt to influence me.”

Mr Yermak said he told Mr Giuliani that he had long known Mr Klitschko and that he had the support of Kyiv’s citizens.

“That was the end of our conversation about Klitschko,” Mr Yermak said. “As a result I reject any speculation that Mr Giuliani in any way sought to influence my opinion or to make me accept some narrative regarding Mayor Vitaliy Klitschko.”

Given the complex and opaque nature of Ukrainian politics, it is not clear whether Mr Giuliani’s intervention was the decisive force allowing the mayor to keep his job. But it is clear he tried.

Donald Trump's personal lawyer Rudy Giuliani speaks at Mar-a-Lago (AFP/Getty Images)

Mr Klitschko, a former heavyweight world boxing champion, first hired Mr Giuliani as a consultant for his unsuccessful run for mayor of Kiev in 2008.

Since 2014, Mr Klitschko has held dual roles: both the largely ceremonial, elected position of Kiev mayor and the powerful position of head of Kyiv’s city-state administration, an appointment made by the Ukrainian president. The latter position gives him oversight of matters such as the city budget, building permits and transportation funds, making him one of the most powerful people in the country.

Mr Klitschko supported President Petro Poroshenko in last spring’s presidential election in Ukraine. Mr Zelenskiy’s landslide victory appeared to augur Mr Klitschko’s political demise.

Mr Zelenskiy, a comedian, had frequently lampooned Mr Klitschko on his “Saturday Night Live”-style variety show, portraying him as a dunderheaded member of Ukraine’s shadowy, corrupt elite. In one skit, Mr Zelenskiy played a translator to a boxing-belt-wearing Mr Klitschko, who is unable to string together an intelligible sentence.

After taking power in May, Mr Zelenskiy had no way to remove Mr Klitschko as mayor but could strip him of the more influential post as head of the Kiev administration. Ukrainian politicians and analysts expected him to do so.

A confidant of Mr Klitschko’s, who spoke on condition of anonymity because he was concerned about harm to his business if he spoke publicly, said that by the end of July, “it was clear that only outside interference, say the president of the United States or anyone on his behalf,” could save Mr Klitschko from dismissal. As the power struggle escalated, Mr Klitschko flew to New York to meet with Mr Giuliani.

On 30 July, in an apparent prelude to the dismissal, Mr Zelenskiy’s chief of staff, Andriy Bohdan, called a news conference and accused Mr Klitschko of allowing corruption to flourish in Kyiv. Without offering evidence, Mr Bohdan said he had been offered a $20 million bribe for Mr Klitschko to remain head of the Kievadministration.

The next day, Mr Klitschko posted photographs on Facebook of his meeting with Mr Giuliani, his “old friend and one of the most authoritative mayors in the world". The two discussed “the situation in Ukraine", he said, “future cooperation between the United States and Ukraine” and the topic of “local self-rule” — an apparent reference to Mr Klitschko’s battle to hold on to power at home.

Upon returning to Kyiv, Mr Klitschko told his aides that his American allies would help him keep his job, according to several people who heard him make the comments in staff meetings and who spoke on condition of anonymity because they are still involved in municipal politics and were afraid to be identified when discussing issues related to Mr Klitschko.

“That’s ridiculous,” Mr Klitschko said in a statement Friday. Asked about the meeting with Mr Giuliani, Mr Klitschko said, “I did not ask anyone for any assistance.”

Mr Klitschko said he had never had a business relationship with Mr Giuliani, a claim contradicted by Mr Giuliani, who consulted for the former boxer’s 2008 campaign. Mr Giuliani said that he had not formally represented Mr Klitschko in years, “even though I still advise him".

But two days later, Mr Giuliani was speaking about Mr Klitschko to Mr Yermak in Madrid.

On 4 September, President Zelenskiy’s cabinet approved the dismissal of Mr Klitschko as head of the Kiev administration.

But on 6 September Mr Giuliani fired off a tweet: “Reducing the power of Mayor Klitschko of Kiev was a very bad sign particularly based on the advice of an aide to the President of Ukraine who has the reputation of being a fixer. The former champion is very much admired and respected in the US.”

The tweet came as Mr Zelenskiy was scrambling to stabilise his relationship with Mr Trump after finding out that US military aid to Kiev had been halted for unexplained reasons.

The last step needed to make the dismissal official was Mr Zelenskiy’s signature on the dismissal — a formality, it seemed, since it was Mr Zelenskiy’s office that had sought approval for the firing in the first place. But the signature never came.

Asked by reporters in October, Mr Zelenskiy said that he was still thinking about whether or not to sign.

“When a controversial issue arises, he tries to balance various interests,” a Kiev political analyst, Volodymyr Fesenko, said of Mr Zelenskiy’s unexpected reprieve. “He decided not to make a sudden move.”

Aside from any influence Mr Giuliani may have had, Mr Fesenko points to a power struggle within different factions in Mr Zelenskiy’s administration as another factor, along with Mr Zelenskiy’s own dwindling political capital amid intense criticism from domestic political opponents that he was too soft on Russia.

Through a spokeswoman, Mr Klitschko declined to comment on the Madrid meeting between Mr Giuliani and Mr Yermak, or on why Mr Zelenskiy decided to keep him in office. He described Mr Giuliani as “a big friend of Ukraine and one of the most successful mayors of the world".

Mr Giuliani himself became a fraught figure in Ukraine as the impeachment investigation unfolded on Capitol Hill.

“Starting in late September, the Giuliani issue became very toxic,” Mr Fesenko said. “It seemed Klitschko’s team stopped pushing the relationship with Giuliani.”