WASHINGTON — Before President Trump fired her as his ambassador to Ukraine, Marie L. Yovanovitch was an anonymous career diplomat who served in the kind of unglamorous posts — Kyrgyzstan, Armenia and eventually Ukraine — typically reserved for civil servants because political donors and friends of the president don’t covet them.
Now Ms. Yovanovitch, known as Masha to her friends and colleagues, is a hashtag on Twitter (#GoMasha) and a reluctant public figure, vilified on the right and lionized on the left. On Friday she told her story publicly for the first time — even as Mr. Trump attacked her in real time on Twitter.
In an impassioned defense of the State Department and the career Foreign Service officers who work — and sometimes give their lives — to advance the interests of the United States, Ms. Yovanovitch recounted how she became the target of a smear campaign by Mr. Trump’s personal lawyer Rudolph W. Giuliani and the right-wing news media.
She wondered aloud how Mr. Giuliani could have succeeded in working with a corrupt prosecutor in Ukraine to oust her, a decorated 33-year veteran diplomat, even though her bosses said she had done nothing wrong.
“How could our system fail like this?” she asked. “How is it that foreign corrupt interests could manipulate our government?”
As Mr. Trump began tweeting, Representative Adam B. Schiff, the chairman of the House Intelligence Committee, began reading them aloud, including one missive in which the president asserted that “everywhere Marie Yovanovitch went turned bad.” He asked Ms. Yovanovitch how that made her feel.
“It’s very intimidating,” she testified. Mr. Schiff replied that Congress would take any attempt at witness intimidation very seriously — an apparent warning to the president.
Her testimony, as the latest witness to appear in the growing impeachment inquiry into Mr. Trump, included discussion of the July 25 telephone conversation that has set off a political crisis for the president, in which he told Volodymyr Zelensky, the president of Ukraine, that Ms. Yovanovitch was “bad news.”
“She’s going to go through some things,” the president said.
Ms. Yovanovitch had already been removed by the time of that call; she learned of it after the president made a reconstructed transcript public as part of the impeachment inquiry. During a private deposition, Ms. Yovanovitch told investigators that she felt “threatened” by Mr. Trump’s remark, and that she still feared retaliation — remarks she reiterated in her testimony on Friday.
“I couldn’t believe it,” she testified, describing herself as “shocked, appalled, devastated that the president of the United States would talk about any ambassador like that to a foreign head of state.”
“It didn’t sound good,” she said of the president’s remark that she would “go through some things.” She added, “It felt like a vague threat.”
Ms. Yovanovitch’s dismissal followed a campaign of attacks against her, led by Mr. Giuliani, the president’s lawyer, who was circumventing State Department diplomats in a shadowy effort to get Mr. Zelensky to investigate Mr. Trump’s political rivals.
Mr. Giuliani branded her a “stooge” and Donald Trump Jr., the president’s eldest son, called her “a joker.” Fox News personalities jumped in, accusing her of being disloyal to the president by criticizing him in private conversations.
Among their complaints: A former Ukrainian prosecutor claimed in an interview with The New York Times that Ms. Yovanovitch had blocked his team from getting visas to the United States to deliver damaging information about Mr. Biden and his son Hunter to the F.B.I.
Ms. Yovanovitch testified that she did indeed block the former Ukrainian prosecutor because he was corrupt. And she pointedly denied some of the conspiracy theories that Mr. Giuliani and his allies spread, including allegations that she was speaking ill of President Trump.
She said no one in the State Department believed them, but told lawmakers that efforts by her colleagues to have Secretary of State Mike Pompeo issue a supportive statement about her were fruitless, because of “concerns up the street” — a reference she took to mean the White House.
“Our Ukraine policy has been thrown into disarray, and shady interests the world over have learned how little it takes to remove an American ambassador who does not give them what they want,” she told the lawmakers, adding that actions like her removal would only embolden America’s adversaries, including President Vladimir V. Putin of Russia.
In earlier congressional testimony, Ms. Yovanovitch said her father fled the Soviet Union and then the Nazis; her mother grew up “stateless” in Germany. She said that background gave her a special empathy for those who had endured poverty, war and displacement.
A native of Canada who moved to Connecticut at age 3 and became an American citizen at 18, Ms. Yovanovitch has spent 33 years with the State Department and is known for her professionalism.
She grew up speaking Russian, graduated from Princeton and joined the State Department six years later. She has worked for presidents of both parties: President George W. Bush appointed her ambassador to Kyrgyzstan, then to Armenia. President Barack Obama named her ambassador to Ukraine in 2016.
There, she pushed for a variety of changes, including ending the immunity enjoyed by legislators accused of crimes. After her ouster, she returned to Washington, and is now a senior State Department fellow at Georgetown University’s Institute for the Study of Diplom