“He walks the walk, O.K.?” said David Mowery, a consultant in Montgomery, the state capital, who helped run a Democratic campaign against Mr. Moore in 2012, less than a decade after Mr. Moore defied a federal judge’s order to remove a 2.6-ton Ten Commandments monument from the Supreme Court building.
“He doesn’t just say he’s going to do this,” Mr. Mowery said. “He gets thrown out of office over it. And then he gets re-elected.”
In order to fill the Senate seat that Attorney General Jeff Sessions held for 20 years, Mr. Moore must pass one more test: a special election in December against the Democratic candidate, Doug Jones, a former federal prosecutor who is a formidable rival, especially by the diminished standards of Alabama Democrats.
Although Mr. Trump said on Friday that Mr. Moore “has a very good chance of not winning” in December, strategists in both parties expect the state’s voters to choose Mr. Moore, who was one of the public figures who stirred doubts about the birthplace of Barack Obama.
If he is elected to the Senate, Mr. Moore will have gotten there as a rare retail politician with a penchant for reciting Blackstone’s Commentaries on common law. At the same time, and to greater political benefit, Mr. Moore, a former professional kickboxer, exhibits traits that many Alabamians see in themselves and seek in their elected officials: He is outwardly pious and prone to political pugilism, self-assured and satisfied with standing alone.
“Roy Moore is Huey Long with religion,” said Jim Zeigler, a Republican who is the state auditor. “Huey Long would tell it like it is. He ran against the establishment, he defeated the establishment, he would not compromise with the establishment. Roy Moore does all those things, but he has a biblical worldview.”
Yet Mr. Moore, who twice ran unsuccessfully for governor, is far from universally beloved in this state. For many people in Alabama, he remains part novelty, part demagogue and part embarrassment, his reputation marred not by bribes or sex scandals but by his brand of stubborn populism. More than once, Mr. Moore has found himself rebuffing comparisons to George C. Wallace, the governor who said in 1963 that he wanted “segregation now, segregation tomorrow and segregation forever.”
Mr. Moore is “a one-issue man, and all of the other things fall to the side,” said Joel Sogol, a lawyer from Tuscaloosa who has tangled with Mr. Moore. “Either you accept those issues from his position or you don’t, and there’s a lot of folks here who accept them.”
Mr. Moore’s fame stems almost entirely from years of pitched legal battles over Ten Commandments displays on public property and over the authority of the federal courts to recognize same-sex marriages. Cast aside, even by some in his own party, as a bigot and a hatemonger, Mr. Moore has turned high-decibel clashes with his critics — he blamed “atheists, homosexuals and transgender individuals” for one conflagration — into opportunities.
In Alabama politics, Mr. Sogol said: “He’s an outsider who has a flag to hold on to. His flag is Christianity, the Bible. There are a lot of people in this area who think that is the No. 1 thing in the world.”
During his periodic exiles from public office, Mr. Moore helped to steer public debate using a nonprofit organization called the Foundation for Moral Law, which says it “exists to restore the knowledge of God in law and government and to acknowledge and defend the truth that man is endowed with rights, not by our fellow man, but by God!”
The organization, which Mr. Moore’s wife now leads, was the subject of a complaint filed to the Internal Revenue Service last week, accusing the group of “repeatedly and expressly” advocating Mr. Moore’s election to the Senate, in conflict with its tax-exempt status. Mr. Moore says the criticism of the organization is politically motivated.
Though he has done little to excise himself from the clamor of evangelical politics, Mr. Moore sometimes complains about being regarded solely as a culture warrior.
“They put me in a religious thing because I acknowledge God,” he said in an interview. “I regret voters don’t hear me talk about laws and all the things I do otherwise in government. When I was on the court, I dealt with everything.”
Service in the Senate presents similarly sweeping challenges, and the Capitol Hill establishment is not likely to roll out a welcome mat for Mr. Moore. He said throughout the campaign that he would be a gadfly, not an obedient follower of the party line laid down by Senator Mitch McConnell, the majority leader, whose allies spent heavily in Alabama trying to help Mr. Strange keep his seat.
“McConnell and all of those people in Washington know I’m not to be controlled,” said Mr. Moore, whose campaign won the support of Stephen K. Bannon, the executive chairman of Breitbart News and Mr. Trump’s onetime chief strategist. “I’m not going to be managed, I’ve never been,” Mr. Moore said.
Though he is dismissive of his party’s leadership, he is no one’s idea of a centrist, and would probably vote the same way as Mr. McConnell on most issues. Like nearly every Southern Republican running for a statewide office this year, he has campaigned on repealing the Affordable Care Act, protecting gun rights, increasing military spending and toughening immigration enforcement.
Yet longtime observers of the man whom many know simply as Judge Moore sometimes struggle for a neat, overarching description of his approach to public policy, beyond simple populism. In his years on the bench, he stayed at something of a remove from the pro-business orthodoxy of the Republicans who have won near-absolute power in Alabama in recent years, and for an array of reasons, business leaders have chronically kept their distance from him.
“He’d probably be considered conservative by some standards, less so by others,” said Jere Beasley, a trial lawyer who once served as a Democratic lieutenant governor and who donated to Mr. Moore’s campaign.
Mr. Beasley praised Mr. Moore for a ruling he handed down on arbitration, but other decisions give his judicial record a texture that surprises both supporters and critics. In occasional dissents, for instance, Mr. Moore voiced support for overhauling sentencing laws that some say are too harsh and too rigid. Writing in a robbery case last year, Mr. Moore said, “There is a difference between justice and overkill.” In another case, he argued that a life sentence for a nonviolent drug crime had shown “grave flaws in our statutory sentencing scheme.”
“He is a populist,” Mr. Zeigler said of Mr. Moore, whose campaign had a fraction of the financial support that Mr. Strange attracted. “I don’t think he intends to be. He just is.”
It is a model that has long proved politically effective. And on Tuesday, at least, it overcame more than $10 million in advertising spending by Mr. Strange’s allies.
“It’s almost the same appeal that Trump has, but it comes from a totally different place,” Mr. Mowery said. “The state’s motto is, ‘We dare defend our rights.’ It kind of starts right there: A lot of people feel Roy Moore is the guy who’s done that.”