Long before Donald Trump entered politics, Ken Cuccinelli II, the former Virginia attorney general turned conservative TV pundit, warned against “an invasion” by illegal immigrants, sponsored a bill seeking to strip those immigrants’ U.S.-born children of their citizenship, and speculated publicly that President Barack Obama was not born in the United States.

Cuccinelli’s reputation as a right-wing firebrand and a favorite of conservative evangelicals helped pave the way for his expected appointment this week to an unspecified senior role on immigration matters at the Department of Homeland Security — a move Senate Majority Leader Mitch McConnell had advised the White House to avoid.

Between his strong rhetoric as a TV surrogate for Trump and his bedrock support among social conservatives, Cuccinelli presented the president with a combination he relishes: someone who seems loyal, is popular with his base, and is good at the politics of disruption and provocation.

Cuccinelli, 50, is a self-declared warrior for traditional Christian values who has stuck to his positions even when it harmed his political fortunes. He lost his 2013 race for Virginia governor after alienating independents and moderate Republicans with his unbending positions on social issues.

He has declared that homosexuality “brings nothing but self-destruction, not only physically but of their soul.” He accused Obama in 2015 of encouraging “an invasion” by illegal immigrants. And on a radio talk show in 2012, he said that a D.C. law that prevented animal control workers from killing rats “is worse than our immigration policy. You can’t break up rat families.

During the 2013 campaign, Cuccinelli did for a time ease up on his anti-immigration positions, at one point removing from his website a statement that he had “voted consistently against in-state tuition for illegal aliens.” (As a state senator, he supported a bill that would have gone further, banning illegal immigrants from attending state colleges at all.)

But since that race, he has returned to the kind of sharp language Trump admires. Like Trump, he openly speculated that Obama was born in Kenya, saying in 2010 that “that doesn’t seem beyond the realm of possibility.” He later backed away from that statement.

Cuccinelli also said shortly before the birth of his seventh child in 2010 that he and his wife were considering refusing to get the baby a Social Security number “because it is being used to track you.”

Cuccinelli was, however, no fan of Trump during the 2016 primaries. Cuccinelli supported Sen. Ted Cruz (Tex.) and disgustedly threw his convention credentials on the floor to protest Trump’s nomination. “Shame! Shame!” he shouted when pro-Trump forces shut down an effort to change the party’s rules to make the nomination process friendlier to conservatives.

In the years since, however, he has become an avid defender of the president. Last week, in a discussion on CNN about why Sen. Lindsey O. Graham (R-S.C.), once a vehement critic of Trump’s, had become one of the president’s strongest supporters, Cuccinelli said that Graham “is a political operator, and he adjusts as the circumstances change. Some of that is politics.” Trump, he said, “has been kind of a learning experience for a lot of people in the Republican Party.”

Cuccinelli had spent his career bucking politics as usual, presenting himself to voters as a principled conservative who would not compromise. He surprised and angered some Virginia Republican leaders in 2013 when he published a book bashing Obama’s health-care overhaul, unleashing strong anti-government rhetoric just as other Republicans in the state were trying to appeal to independent and moderate voters with a less abrasive message.

Major donors, business leaders and moderate GOP politicians called Cuccinelli too extreme. The U.S. Chamber of Commerce, which had given $1 million in campaign donations to Virginia’s last Republican governor, Bob McDonnell, gave Cuccinelli nothing. Then-Lt. Gov. Bill Bolling, who withdrew from the 2013 race for the Republican nomination for governor, refused to endorse Cuccinelli, saying the party needed to “reconnect with a more diverse voter base.”

The candidate was unapologetic. He insisted he would win by sticking to “first principles” — his long-held view that voters craved a politician who stood up for the Constitution, morality and limited government.

“This is a referendum on growing or resisting Obamacare,” Cuccinelli told supporters in the final days of the campaign. “If you like it, vote for them. If you don’t, vote for me.”

He lost to Democrat Terry McAuliffe.

Cuccinelli, who started out as a state senator from Fairfax County in the D.C. suburbs, often won attention as a crusader for socially conservative causes. He proposed to protect employers who fired workers for not speaking English on the job. As Virginia’s attorney general, he told the state’s public colleges that they could not use the term “sexual orientation” in nondiscrimination policy statements — a ruling that the state’s Republican governor reversed.

A feisty combatant going back to his student days, Cuccinelli first won attention at the University of Virginia by siding with the school’s feminist group to press administrators to hire a professional to deal with sexual violence on campus. He supported and worked for Democrat Doug Wilder, Virginia’s first black governor, in the early 1990s before he turned solidly Republican.

But he has consistently railed against the idea that it’s the government’s job to ease people’s burdens.

“Life isn’t necessarily fair and it’s not government’s job to make it fair,” he wrote in “The Last Line of Defense,” his anti-ACA book. Taking care of the poor, he said, is the job of “families, churches and charities, not the government.”

Democrats and some Republicans saw Cuccinelli as a faith-driven warrior, more interested in making a point than in making a deal.

“He didn’t drink the Kool-Aid; he made it,” Dick Saslaw (D-Fairfax), the state Senate minority leader, said in 2013. “You name the antiabortion tactic and he was for it. Believe me, we had some very conservative people in the Senate and they winced at his bills, they were so extreme. Whether it was bashing gays or immigrants, nobody wanted to be associated with him.”

But a fellow Republican from Fairfax, former delegate Dave Albo, said during that same campaign that Cuccinelli was “really not the crazed maniac we read about in the paper. It took me a while to figure it out: Ken Cuccinelli is Catholic, and a lot of Catholics believe the rules are the rules.”

Cuccinelli himself has always granted that he is not the compromising type. “I don’t back down,” he once told an audience of evangelical leaders. “I’m not afraid to lose. What happens if I lose? I go home. I like going home.”