In February, the U.S. ambassador to Ukraine — a 33-year career diplomat who had served presidents of both parties — received a blunt warning.

“Watch your back,” Ambassador Marie Yovanovitch said she was told by Ukraine’s interior minister.

The Ukrainian official relayed that a pair of Florida businessmen and a Kyiv prosecutor with whom Yovanovitch had clashed were working to oust her from the post she had held since 2016, she later told House investigators.

The trio had a powerful ally, he added: President Trump’s personal attorney Rudolph W. Giuliani.

“I thought it was exceedingly strange,” Yovanovitch said, according to a transcript of her closed-door testimony last month.

The impeachment inquiry has pulled back the curtain on a long and murky effort to engineer the ambassador’s removal — one driven by an array of figures whose motives are still not fully understood. They include a former U.S. congressman-turned-lobbyist, a then-sitting member of Congress and the two Giuliani associates, Lev Parnas and Igor Fruman, who have since been charged with campaign finance crimes.

Yovanovitch’s public testimony Friday is expected to showcase how what appears to have begun as the personal crusade of private individuals became intertwined with efforts to use Ukraine to benefit Trump politically.

The attacks on the ambassador — and the fact that the president capitulated to the smear effort against her — led to widespread alarm among national security officials, several told Congress in recent weeks.

“She’d been subject to a pretty ruthless, nasty defamation to basically remove her from her place,” former National Security Council adviser Fiona Hill testified in her closed-door deposition last month.

“The most obvious explanation,” Hill testified, “seemed to be business dealings of individuals who wanted to improve their investment positions inside of Ukraine” as well as an effort “to deflect away from” findings that Russia had interfered in the 2016 presidential election.

Yovanovitch has said she knows little about the pressure the administration put on Ukraine to investigate Trump’s political opponents, much of which occurred after her departure from Kyiv, but her appearance Friday offers the possibility of a compelling emotional moment in the Democrats’ impeachment hearings.

The little-known diplomat has described how she was taken aback when conservative media began to advocate her removal in March and to spread her name on social media, where the president’s son Donald Trump Jr. called her “a joker.”

And she has said she was shocked and frightened when she read a rough transcript of Trump’s call with Ukrainian President Volodymyr Zelensky, released in September, in which the U.S. president called her “bad news” and predicted she would “go through some things.”

'The best of the best'

Born in Canada to parents who had fled the Soviet Union, Yovanovitch joined the Foreign Service after graduate school in 1986. Since then, she has served in seven countries, across the administrations of six American presidents, including as ambassador to Kyrgyzstan and Armenia.

In May 2016, she was named ambassador to Ukraine by President Barack Obama and, this spring, the Trump administration asked her to extend her service there into 2020.

In testimony, colleagues vouched for Yovanovitch’s professionalism and expertise.

“The best of the best, in terms of a nonpartisan career official,” Hill testified, noting that it is rare for women to reach the upper ranks of the diplomatic corps. “I just see her as epitomizing what United States diplomacy should be.”

Top State Department official George Kent added that Yovanovitch was “someone who follows very [strictly] what is deemed proper and proprietary.”

In her post, Yovanovitch worked to advance U.S. interests by countering Russian aggression and backing new legal structures intended to root out long-standing corruption in Ukraine’s economy, she and others testified.

The mission earned her enemies, Kent told the House this week.

“You can’t promote principled anti-corruption action without pissing off corrupt people,” he said.

The first signs that forces were agitating to push her out came in 2017 or 2018.

It was then that veteran Foreign Service officer Catherine Croft received “multiple calls” from a prominent Republican lobbyist, former Louisiana congressman Bob Livingston, urging Yovanovitch’s firing, she told lawmakers.

At the time, Croft was detailed to the National Security Council and reported the curious calls to her superiors.

“He characterized Ambassador Yovanovitch as an ‘Obama holdover’ and associated [her] with George Soros,” the wealthy liberal donor, Croft said in a written statement provided to the committee. “It was not clear to me at the time — or now — at whose direction or at whose expense Mr. Livingston was seeking the removal of Ambassador Yovanovitch.”

Livingston did not respond to repeated requests for comment.

Justice Department records show Livingston is registered as a lobbyist representing companies and organizations connected to Yulia Tymoshenko, a Ukrainian politician with energy investments, who has sought to regain political power in Ukraine since she lost her job as prime minister in 2010.

Jim Slattery, a Washington lawyer who represented Tymo­shenko in the past, rejected the idea that his friend and former client would have sought the removal of Yovanovitch.

“I have no knowledge of her directing anyone to seek the removal of the ambassador and I am confident that, if she had, I would know,” he said, adding that Yovanovitch is “a competent and dedicated” diplomat who has commanded “enormous respect” across party lines.

Yovanovitch was also a topic of discussion at a small dinner for top Trump donors in a private suite of the Trump hotel in Washington attended by the president and Donald Trump Jr. on April 30, 2018.

In attendance were Parnas and Fruman, who had pledged a major donation to a pro-Trump super PAC. Last month, the two men were arrested at Dulles International Airport and charged with illegally funneling foreign money into U.S. campaign contribution. .They have pleaded not guilty.

According to federal prosecutors, Parnas and Fruman had also embarked on an effort to oust Yovanovitch at the request of an unidentified Ukrainian government official.

An attorney for Parnas, Joseph A. Bondy, has denied that claim and has said Parnas was not motivated by personal business interests. A lawyer for Fruman, Matt Blanche, declined to comment.

During the 2018 dinner, Parnas has told associates, he and Fruman told Trump that Yovanovitch was unfriendly to the president’s interests, people familiar with his account have said. Parnas claimed that Trump had an immediate and visceral reaction: He declared Yovanovitch should be fired.

Ten days later, Parnas was on Capitol Hill, meeting with then-Rep. Pete Sessions (R-Tex.), according to photos he posted online. That same day, Sessions penned a letter to Secretary of State Mike Pompeo complaining that Yovanovitch was biased against Trump, according to the indictment of Parnas and Fruman.

Sessions has said he did not “take any official action” as a result of his meeting with Parnas and sent the letter because he had come to believe Yovanovitch was bad-mouthing Trump abroad.

The letter played a significant role in spreading dissent about Yovanovitch in Washington. Giuliani has told The Post that it was Sessions who helped inspire Trump’s distrust for her.

Giuliani has said he was introduced to Parnas and Fruman by a mutual friend in the summer of 2018, and eventually collected $500,000 to advise a company Parnas started called Fraud Guarantee.

By early this year, Parnas and Fruman were also working with Giuliani on his efforts to dig up dirt on Democrats in Ukraine. They helped connect him to former Ukrainian officials who claimed their country had interfered in the 2016 U.S. presidential election and that an investigation into former vice president Joe Biden’s son Hunter had been quashed.

Determined adversaries

In so doing, the two men linked Giuliani up with some of Yovanovitch’s most determined Ukrainian adversaries.

One was Yuri Lutsenko, who had been appointed prosecutor-general in 2016. Yovanovitch testified that she had at first hoped Lutsenko would clean up the prosecutor’s office, but that he failed to do so.

By 2018, he was openly complaining about the ambassador and clashing with an independent anti-corruption bureau, known as NABU, which was set up in the aftermath of a 2014 pro-Europe uprising and that was supported by the United States and other Western allies.

Giuliani met with Lutsenko in New York in January to discuss the possibility that Ukraine would open a new investigation into the 2016 election or Burisma, an energy company whose board of directors included Hunter Biden, The Post previously reported.

Notes from Lutsenko’s meeting with Giuliani that were turned over the State Department’s inspector general and submitted to lawmakers show that Lutsenko also discussed Yovanovitch with Giuliani, accusing her of spending “money on good public relations for NABU.”

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

As vice president, Biden had pushed for the firing of Shokin, who U.S. and European officials believed was not sufficiently aggressive in pursuing corruption cases. Shokin has claimed that he was fired because his office was investigating Burisma and Biden’s son — a probe that anti-corruption activists and former officials said was actually dormant at the time.

The decision to deny Shokin a visa was made at the recommendation of career consular staff, Yovanovitch testified. Angered, Giuliani appealed the decision to the White House and senior State Department officials, she said.

Consular officials, she said, “held firm.” Shokin was forced to meet with Giuliani via Skype, rather than in person. In their conversation, Shokin claimed that Yovanovitch was “close to Biden,” Giuliani’s notes show.

Before his arrest, Parnas told The Post in September that Giuliani was upset by the episode and suggested that it contributed to Yovanovitch’s ouster. “That’s why I think the ambassador’s not there,” Parnas said.

By March, Parnas and Fruman were telling associates that Yovanovitch would soon be removed from her post, according to people who encountered them.

At an energy conference in Houston, they explained to a top official at Ukraine’s state-owned gas company that Yovanovitch stood in the way of their plans to broker gas deals in Kyiv, according to an American energy executive, Dale Perry, who spoke to the gas company executive soon afterward.

The agitation against Yovanovitch became public that same month, when conservative columnist John Solomon interviewed Lutsenko for the Hill. In the interview, Lutsenko alleged that Yovanovitch had given him a list of people he could not prosecute.

The State Department issued a statement calling the allegation an “outright fabrication.” and Lutsenko quickly recanted. Last month, he told the New York Times that his interview had been mistranslated.

Soon after The Hill column was published, Trump Jr. fanned the flames, retweeting another article calling for her removal and writing we need “less of these jokers as ambassadors.”

An abrupt ouster

In late April, Yovanovitch testified she received a call to leave Kyiv “on the next plane” to meet with top State Department officials. The department’s No. 2 official at the time, John J. Sullivan, who has since been nominated to be the U.S. ambassador to Moscow, told her she was being recalled from her job in Kyiv because the president had lost trust in her.

“Although I understand that I served at the pleasure of the president, I was nevertheless incredulous that the U.S. government chose to remove an ambassador based, as best as I can tell, on unfounded and false claims by people with clearly questionable motives,” she told the House panel last month.

Veteran diplomat Michael McKinley, a top aide to Pompeo, testified that after the rough transcript of Trump’s call with Zelensky was released in September, he urged the secretary of state to issue a public statement in support of the ambassador.

When Pompeo didn’t respond, McKinley said he emailed other senior officials proposing a “strong and immediate statement of support for Ambassador Yovanovitch’s professionalism and courage.”

A few hours later, one of the recipients of McKinley’s email, a State Department spokesman, called to say that Pompeo had rejected the idea, citing a desire to protect Yovanovitch from “undue attention,” he testified.

McKinley resigned 12 days later. He told lawmakers he had no choice.

“Since I began my career in 1982, I have served my country and every president loyally,” he said. “Under current circumstances, however, I could no longer look the other way as colleagues are denied the professional support and respect they deserve.”

Alice Crites contributed to this report.