President Trump announced Friday that Rep. John Ratcliffe, R-Texas, is withdrawing as his nominee for director of national intelligence, citing his tough treatment at the hands of “the LameStream Media.”

In a tweet, Trump said that Ratcliffe, whom he tapped to replace Dan Coats, will stay in Congress.

JOHN RATCLIFFE COULD GO FROM SMALL TOWN MAYOR TO TRUMP'S INTELLIGENCE CZAR

“Our great Republican Congressman John Ratcliffe is being treated very unfairly by the LameStream Media. Rather than going through months of slander and libel, I explained to John how miserable it would be for him and his family to deal with these people,” he wrote. “John has therefore decided to stay in Congress where he has done such an outstanding job representing the people of Texas, and our Country.”

He added that he will be announcing his new nominee to replace Coats “shortly.”

Ratcliffe, a former federal prosecutor who had been a fierce defender of Trump and his agenda, was one of the most vocal critics of former Special Counsel Robert Mueller’s investigation into Russian interference in the 2016 election.

The congressman made headlines last month when he grilled Mueller during a hearing on Capitol Hill.

REP. JOHN RATCLIFFE: 'IMPEACHMENT BALLOON GOT POPPED COMPLETELY TODAY'

"You wrote 180 pages about decisions that weren’t reached, about potential crimes that weren’t charged or decided," Ratcliffe said to Mueller. "Respectfully, by doing that, you managed to violate every principle and the most sacred of traditions about prosecutors."

He also sided with Trump in taking a hard line on immigration, voting in January against the appropriations bill to end a government shutdown because it did not include all the funding for the president’s proposed border wall.

In the House, Ratcliffe has served on the Intelligence, Homeland Security, Judiciary and Ethics Committees. In 2016, the Heritage Foundation ranked Ratcliffe as the most conservative Texas legislator in Congress and second-most conservative legislator in the country.

Ratcliffe likely would have faced a fierce confirmation battle as Democrats claimed the former mayor of the small town of Heath had been selected due to his loyalty rather than experience.

"It's clear that Rep. Ratcliffe was selected because he exhibited blind loyalty to President Trump with his demagogic questioning of former Special Counsel Robert Mueller," Senate Minority Leader Chuck Schumer, D-N.Y., said in a statement. "If Senate Republicans elevate such a partisan player to a position that requires intelligence expertise and non-partisanship, it would be a big mistake."

A source familiar with Trump's thinking told Fox News that there were "deep reservations" about Ratcliffe among multiple senior administration's officials, and that the president is now going back to the drawing board.

Ratcliffe said on Twitter that he was "humbled and honored" that Trump had initially picked him for the role.

"However, I do not wish for a national security and intelligence debate surrounding my confirmation, however untrue, to become a purely political and partisan issue," he said. "The country we all love deserves that it be treated as an American issue."

CLICK HERE TO GET THE FOX NEWS APP

He had also been the subject of a number of media reports that said he overstated part of his biography and record.

The New York Times reported that Ratcliffe, who claimed he had tried suspects accused of funneling money to Hamas, had in fact investigated side issues relating to an initial mistrial rather than prosecuting the case itself.

The Washington Post, meanwhile, challenged a claim on Ratcliffe's website saying that as U.S. attorney he arrested "over 300 illegal immigrants in a single day." The outlet reported he played only a supporting role in a 2008 roundup of illegal immigrants, and only 45 workers were charged by prosecutors.

Fox News’ Gillian Turner and Andrew O’Reilly contributed to this report.