Transcript for Judge Roy Moore, the righteous cowboy who hopes to become Alabama's next senator
Reporter: The man who hopes to become Alabama's next U.S. Senator, judge Roy Moore, rode to victory Tuesday. His white Stetson hat straight out of central casting. I believe in the second amendment. Reporter: The righteous cowboy. Ready for a day of reckoning. We've got to go back to god. We've got to go back to a moral base. Reporter: Some of president trump's most ardent supporters see Moore as their type of guy. A vote for judge Roy Moore is a vote for Donald J. Trump. Reporter: Donald Trump himself, not so much. He endorsed the other guy. On Tuesday, we're going to send a real fighter and a real good guy from Alabama to the United States senate. Reporter: Moore first made national headlines back in the early 2000s when he installed this giant statue of the ten commandments in the rotunda of the Alabama state supreme courthouse. I have acknowledged god as the moral foundation of our law. It's my duty. Reporter: A decision that ran afoul of a series of federal courts. We've allowed the acknowledgement of god to be taken from us because three lawyers walked in this building and are offended in looking at god's word. Reporter: "Nightline" follow the issue for years. After the case went all the way to the U.S. Supreme court, the monument was finally removed and justice Moore was ultimately fired. Reporter: Moore later was re-elected to the state supreme court. But he defied the federal courts again on the issue of same-sex marriage. He'd use hoview homosexuality as sinful. It is immoral, defined by the law as detestable, against the law in most states before the supreme court in Texas said it wasn't -- Reporter: A c-span2 all places. That led to this spirited debate. Where in the constitution do you find any support for your position that you can outlaw certain kinds of sexual activity which you don't approve of. I find no support in the constitution to authorize sodomy in our law. Roy Moore operates on the fringes of American politics. Even in the trump era he is out there with views far more conservative than most of his potential colleagues in the senate, far to the right of even people in Alabama. Reporter: Moore's opponent, Luther strange, a former Washington lobbyist seen by some of the president's own supporters as a creature from the swamp trump promised to drain. I spoke with ABC news political director Rick Kline. Why did he back Luther strange? Two theories circulating. One is trump just wanted to do it. He felt this guy's been loyal to him, why not, got pressure from Mitch Mcconnell. The other is he was thinking about governing for a change, wasn't just thinking about politics. Saying, who is going to go in there and vote for the things that I want done? Reporter: To the many who rallied behind the trump train -- This isn't a campaign, this is a movement. Reporter: The choice here was obvious. They did not want to go with the candidate anointed by the establishment in Washington. They have no interest at all in what you have to say, what you have to think, or what you want to do. Reporter: In fact, both Republicans claim to be trump's heirs. The problem is, president trump's being cut off in his office. He's being redirected by people like Mcconnell. Who do not support his agenda. Reporter: Today in the aftermath of this political setback, the president started deleting his tweets for Luther strange. Trump sought to spin Moore's victory as great news. Well, we have a man who's going to be a great senator. And I -- I'm very happy with that. Reporter: The results left Luther strange politely scratching his head. I'm telling you. The seas, the political seas, the political winds in this country are very hard to navigate. There's a theory that says this is going to work well for Donald Trump because he never really wanted to build up the Republican party, he had no interest in keeping the establishment intact, he wants to blow things up. Reporter: Judge Moore made it clear there's no hard feelings on his side. Together we can make America great. We can support the president. Reporter: He pledged to support the president's agenda. But added a potentially significant caveat. As long as it's constitutional. But we have to return the knowledge of god and the constitution of the united States to the United States congress. Roy Moore is going to have considerable sway as someone that is a thought leader on the conservative side and someone who controls a critical vote. He doesn't have the job just yet. Come December, judge Moore will face Democrat Doug Jones, a contest that's sure to be a showdown. I'm David Wright for "Nightline" in New York.
This transcript has been automatically generated and may not be 100% accurate.