He has been vilified by President Trump as “the FBI’s sick loser.”

His name has been uttered on countless Fox News segments to cast doubt on special counsel Robert S. Mueller III’s Russia probe.

On Thursday, after weeks of itching to speak out on his own behalf, the man best known for his private anti-Trump text messages made his public debut, stepping out before some six dozen lawmakers at a joint committee hearing on Capitol Hill.

“I am here under oath, I am not lying, I have never lied under oath, and I never will,” FBI agent Peter Strzok said in one of several tense exchanges with Republican lawmakers.

In a hearing filled with theatrics, Strzok was alternately praised for his impassioned defense of the bureau against accusations of partisanship and berated for his scathing text messages about then-presidential candidate Trump to former FBI lawyer Lisa Page, with whom Strzok was having an affair at the time.

Through it all, Strzok emerged as a largely unflappable, if unlikely, champion of the very bureau that removed him from his role in the Russia investigation last July.

He prompted cheers from some in the room when he called attacks on the FBI’s integrity “deeply destructive.”

But he was derided by Republicans as a partisan hack out to get Trump.

The House Judiciary Committee hearing for FBI agent Peter Strzok quickly devolved into a shouting match over procedures and rules. (JM Rieger/The Washington Post)

“No wonder Bob Mueller kicked you off of the investigation, Agent Strzok,” House Oversight Chairman Trey Gowdy (R-S.C.) told him.

He came prepared to defend the bureau’s political neutrality, making note of the various layers of supervisors and analysts involved in its work. “They would not tolerate any improper behavior in me, any more than I would tolerate it in them. That is who we are as the FBI,” Strzok said.

And he decried alleged Russian interference in U.S. elections, describing the hearing — which Strzok himself had sought in an effort to clear his name — as “just another victory notch in Putin’s belt and another milestone in our enemies’ campaign to tear America apart.”

Strzok did not make it to the hearing room without a battle. He first offered to testify publicly last month following the release of a report by the Justice Department inspector general that singled him out for strong criticism. The House Judiciary Committee initially denied him that opportunity but agreed to conduct a closed-door interview, which lasted 11 hours.

The committee then changed course and issued a subpoena for Strzok’s public testimony, which prompted the FBI agent’s attorney to accuse Republicans of playing political games and seeking to “trap” his client.

When Strzok did make the long-anticipated public appearance, he was rewarded with hours of heated questioning, shouting and bickering by members of the House Judiciary and Oversight committees in a spectacle that put the country’s fierce partisan divisions on display.

In one exchange, at the direction of Rep. Darrell Issa (R-Calif.), a deadpan Strzok read aloud some of the text messages he had sent to Page, including ones in which he called Trump an “idiot” and a “disaster.”

When Issa asked Strzok to repeat one text message that contained a profanity, the agent replied without missing a beat. “Okay, sir. Sure,” he said. “Happy to indulge you.”

Democrats alternated between describing the hearing as an outrage and mocking it as a joke.

“This hearing is a kangaroo court,” said Rep. Hakeem Jeffries (D-N.Y.). “It is a three-ring circus. It is not even meritorious of an investigation by Ace Ventura, Pet Detective, let alone 75 members of the United States Congress. Let’s stop wasting taxpayer dollars and get back to the business of the American people.”

Strzok kept his composure even as the sparring veered from the partisan to the personal. As the public grilling entered its fifth hour, Rep. Louie Gohmert (R-Tex.) took aim at Strzok’s “little smirk” and said he couldn’t help wondering: “How many times did you look so innocent into your wife’s eye and lie to her about Lisa Page?”

Strzok looked straight ahead, his somewhat bemused expression unchanging, as the room erupted into a cacophony of yells, with one lawmaker firing back at Gohmert, “You need your medication!”

Thursday’s marathon hearing was carried live for most of the day on all three cable news networks. One of the few interruptions came when the networks cut away for a 10-minute window to broadcast a rather incongruous scene far from steamy Washington: the pomp and circumstance of Trump’s arrival at stately Blenheim Palace in Oxfordshire, England, where the president was to join British Prime Minister Theresa May for a black-tie dinner on the second leg of his week-long Europe trip.

At a time of fierce political divisions, few matters have polarized the public as much as the Russia investigation, and Trump has relentlessly used his Twitter bully pulpit to criticize the probe, often seizing on Strzok and Page — the “two FBI lovers” — to make his point. Last Saturday, Trump tweeted that Americans were beginning to sour on the investigation, which he described, as he often has, as a “Rigged Witch Hunt.”

“Public opinion has turned strongly against the Rigged Witch Hunt and the ‘Special’ Counsel because the public understands that there was no Collusion with Russia (so ridiculous), that the two FBI lovers were a fraud against our Nation & that the only Collusion was with the Dems!” Trump said.

A Washington Post-Schar School poll conducted from June 27 to July 2 suggests that the attacks by Trump and Republicans on the Russia probe have had an impact, particularly among Republicans.

In January, 49 percent of Republicans disapproved of the Mueller investigation. That number had shot up to 78 percent by early July. Views among Democrats have remained steady at 20 percent disapproval, while disapproval among independents rose from 29 percent to 43 percent. Among all adults, 31 percent disapproved of the Mueller investigation in January, compared with 45 percent in July.

Partisans on both sides found much to like in the hearing.

“Strzok is running circles around @RepGoodlatte. Totally humiliating for a member of Congress to get owned by a witness like this,” tweeted Obama White House veteran Tommy Vietor.

Conservative commentator Ann Coulter said in a tweet:“I hope lots of Americans are watching the Strzok hearings. Fox should cancel weekend programming & just play this hearing over & over again.”

As the eighth hour of the hearing was underway, Rep. Paul A. Gosar (R-Ariz.) brought up an earlier, tense faceoff between Strzok and Gowdy over comments Trump had made during the 2016 campaign about a Gold Star military family.

“By the way, I’m a dentist, so I read body language very, very well,” Gosar said, telling Strzok that he appeared “very angry” when discussing Trump’s comments.

Strzok said he disagreed.

“I don’t know if you’re saying this experience is like being at the dentist,” he said, drawing murmurs from the crowd. “But I would tell you, sir, what you see in my response is a genuine passion for the United States of America.”