Former Attorney General Jeff Sessions officially announced Thursday that he is running for Senate in Alabama. If he prevails in the crowded Republican primary, Sessions would challenge Senator Doug Jones, who is considered the most vulnerable Democrat in the Senate.

"When President Trump took on Washington, only one senator out of a hundred had the courage to stand with him: me," Sessions said in a statement. "I was the first to support President Trump. I was his strongest advocate. I still am. We can make America great again."

In his statement, Sessions acknowledged he and Mr. Trump "have had our ups and downs." He said it would have been "dishonorable" to "go on CNN and attack the president" after he was forced out by Mr. Trump.

Get Breaking News Delivered to Your Inbox

Appearing on Fox News' "Tucker Carlson Tonight" minutes after making his campaign website live, Sessions touted his support of the Trump administration's hardline immigration policies. Sessions told Carlson he did not regret recusing himself from the investigation into Russian meddling in the 2016 election.

"I did the thing I had to do under the rules of the Department of Justice," Sessions explained. "But I know how painful it was for the president."

Jeff Sessions seen November 1, 2018, in Washington, D.C. Getty

Sessions resigned from his Senate seat, which he had held since 1997, at the start of the Trump administration. Wednesday marked the two-year anniversary of Sessions' resignation from his role as attorney general. Mr. Trump forced out Sessions in retaliation over Sessions' recusal.

Jones, a former U.S. attorney, is the only Democrat to hold statewide office in deep-red Alabama, a state Mr. Trump won by 28 points in 2016. His election followed an unusual series of events for the office, including the Republican primary victory of Roy Moore, a divisive figure in Alabama politics who was later accused of pursing teenage girls while he was in his 30s.

As attorney general, Sessions was a strong backer of the Trump administration's immigration crackdown and defended the travel ban during several court challenges. He faced protesters at college appearances earlier this year in Massachusetts and Minnesota.

Sessions, who was consistently ranked as one of the most conservative senators, has a long history in Washington. In 1986, President Reagan nominated Sessions to be a judge for the U.S. District Court for the Southern District of Alabama. He was not confirmed, and the Senate Judiciary Committee voted 10-8 against recommending Sessions to the whole Senate.

Four lawyers who worked with Sessions said during that hearing he had made racist comments, including calling the NAACP "un-American." He apologized for once joking that he thought the Klu Klux Klan was "OK until they found out I smoked pot."

During his time in the Senate, he served on the Senate Judiciary Committee.

An early backer of Mr. Trump and later a campaign adviser, Sessions' appointment as attorney general was confirmed by a razor-thin margin of 52-47 in the Senate, almost entirely along party lines. But Sessions did not disclose his contact with Russian ambassador Sergey Kislyak during the campaign when asked at his confirmation hearing about contacts between the campaign and the Russian government.

As a result, he recused himself from the Justice Department's investigation into Russian meddling into the 2016 election. Later, the Justice Department appointed a special counsel, Robert Mueller, to lead the investigation.

Mr. Trump was never happy that Sessions recused himself and that Deputy Attorney General Rod Rosenstein had appointed a special counsel, saying it would be "the end" of his presidency. "Oh my God. This is terrible. This is the end of my presidency. I'm f**ked," Mr. Trump told Sessions during an Oval Office meeting at the time, according to the Mueller report.

When Sessions resigned from his Senate seat in 2017, former Alabama Governor Robert Bentley appointed Luther Strange, who was state attorney general at the time, to the seat. Bentley, who was on the brink of impeachment, resigned shortly after appointing Strange, who was investigating him. Bentley pleaded guilty to two misdemeanors in exchange for not being prosecuted on ethics and campaign finance charges. Strange has denied any wrongdoing.

In an August primary against Moore and Congressman Mo Brooks, who Mr. Trump had backed, Strange failed to garner the 50% needed to avoid a runoff. Mr. Trump came out heavily in favor of Strange in the September runoff primary, but Moore won the primary.

Moore previously served as chief justice of the Alabama Supreme Court, but was removed twice — once for defying a federal judge's order to remove a Ten Commandments monument from the state judicial building. Then, after he was elected again, a judicial discipline panel permanently suspended Moore in 2016, ruling that he urged probate judges to deny marriage licenses to same-sex couples in defiance of the federal courts.

Between the primary and the special election in December, Moore denied allegations of sexual misconduct, calling the initial story from The Washington Post — later confirmed by CBS News — a "completely false and a desperate political attack."

The Republican Party at first backed away from Moore, but he remained defiant and denied the allegations. Eventually the RNC conceded and threw their support behind him. Mr. Trump even recorded a robocall and tweeted on the day of the election "Vote Roy Moore!"

The allegations were enough to drive Democratic turnout toward Jones, costing Republicans what had been considered one of their safest seats in the Senate. The Senate Leadership Fund said in a statement June 20 that they were confident Alabama Republicans would "realize that nominating" Moore would be akin to "gift-wrapping" the Senate seat for the Democrats, according to AL.com.

Kathryn Watson contributed reporting.