President Trump on Sunday announced that Texas GOP Rep. John Ratcliffe, a staunch White House ally, will replace Dan Coats as director of national intelligence (DNI), following months of speculation and public spats between the president and the intelligence community.

The move prompted immediate outrage from many top Democrats who accused the president of seeking to appoint a blindly loyal yes-man to the key post.

A source close to the matter told Fox News that Coats never saw his 2017 appointment as a long-term proposition. Ratcliffe has been well-versed in the intelligence community after driving key sections of ongoing Republican-led probes into apparent Foreign Intelligence Surveillance Act (FISA) abuses by the FBI and Justice Department, Fox News is told.

Coats submitted his letter of resignation to President Trump on Sunday. Part of it read: "The Intelligence Community is stronger than ever, and increasingly well prepared to meet new challenges and opportunities. As we have previously discussed, I believe it is time for me to move on to the next chapter of my life."

READ THE LETTER: DAN COATS SUBMITS RESIGNATION TO PRESIDENT TRUMP

"I am pleased to announce that highly respected Congressman John Ratcliffe of Texas will be nominated by me to be the Director of National Intelligence," Trump tweeted.

"A former U.S. Attorney, John will lead and inspire greatness for the Country he loves," Trump added. "Dan Coats, the current Director, will be leaving office on August 15th. I would like to thank Dan for his great service to our Country. The Acting Director will be named shortly."

Coats frequently appeared out of step with Trump during his two-year tenure, and their frayed relationship reflected broader divisions between the president and the government's intelligence agencies.

For instance, Coats revealed to then-Special Counsel Robert Mueller's investigators how Trump, angry over investigations into links between his campaign and Russia, tried unsuccessfully in March 2017 to get him to make a public statement refuting any connection.

"Coats responded that the Office of the Director of National Intelligence (ODNI) has nothing to do with investigations and it was not his role to make a public statement on the Russia investigation," Mueller's report said.

And, last year at the Aspen Security Forum, Coats did a double-take when host Andrea Mitchell broke the news on stage that Vladimir Putin was planning a trip to Washington.

"Say that again?" he asked, to laughter in the audience. "OK, that's going to be special."

Coats later said he meant no disrespect to Trump and admitted the moment was "awkward."

"Some press coverage has mischaracterized my intentions in responding to breaking news presented to me during a live interview. My admittedly awkward response was in no way meant to be disrespectful or criticize the actions of the President," Coats said.

In a statement, Senate Minority Leader Chuck Schumer, D-N.Y., condemned Ratcliffe's selection and pointed to the congressman's performance during last week's hearings with Mueller.

During his questioning, Ratcliffe told Mueller that he had acted improperly -- and trampled on the presumption of innocence -- by saying in his report that Trump had not been "exonerated."

"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," Schumer said. "If Senate Republicans elevate such a partisan player to a position that requires intelligence expertise and non-partisanship, it would be a big mistake."

Senate Majority Leader Mitch McConnell, R-Ky., meanwhile, responded: "I was very sorry to learn today that Director Coats will depart his position as Director of National Intelligence later this month. My friend and former colleague has devoted decades of his life in service to our country. I was reassured knowing that a man who took such a deliberate, thoughtful, and unbiased approach was at the helm of our intelligence community."

"The departure of DNI Coats is bad news for the security of America," House Speaker Nancy Pelosi, D-Calif., said. "DNI Coats' successor must put patriotism before politics, and remember that his oath is to protect the Constitution and the American people, not the President."

Senate Intelligence Committee Vice Chairman Mark Warner, D-Va., praised Coats' tenure for staying "true" to the intelligence community's mission and "speaking truth to power."

CNN national security analyst Shawn Turner, Rep. Adam Schiff, D-Calif., Sen. Elizabeth Warren, D-Mass., and Council on Foreign Relations president Richard Haass also each separately praised Coats specifically for "speaking truth to power" on social media -- prompting Republican consultant Arthur Schwartz to note that "talking points have been distributed."

Reaction from Republican lawmakers to Ratcliffe's selection appeared positive across the board. House Homeland Security Committee Ranking Member Mike Rogers, R-Ala., called Ratcliffe an "excellent pick to be director of national intelligence."

"His experience on the Homeland Security Committee and as former Cybersecurity, Infrastructure Protection, & Innovation Subcommittee chairman will serve him well in this new role," Rogers said. "I thank Director Coats for his leadership and years of public service.”

And, House Oversight Committee Ranking Member Jim Jordan, R-Ohio, said Ratcliffe was a "great pick."

TRUMP AT WAR WITH HIS OWN INTEL CHIEFS AS DIVIDE DEEPENS

Speculation about Coats' ouster had been lingering in recent days. Sources told Fox News earlier this month that Trump spoke to two people recently about the job. Among the candidates he was considering at the time were Gen. Joseph Dunford, chairman of the Joint Chiefs of Staff, and Fred Fleitz, who previously served as chief of staff to National Security Adviser John Bolton.

Trump raised the possibility of the job with Fleitz as far back as February and asked if he was interested but did not offer it to him officially. It's unclear how many other potential candidates may have been in the mix.

Trump regularly and openly sparred with Coats and the intelligence community. “Perhaps Intelligence should go back to school!” he tweeted in January, after Coats and CIA Director Gina Haspel testified about a threat-assessment report that called into question some of Trump's foreign policy judgments.

DID U.S. INTELLIGENCE TRY TO ENTRAP TRUMP AIDE?

Coats said North Korea would be "unlikely" to give up its nuclear weapons or its ability to produce them because "its leaders ultimately view nuclear weapons as critical to regime survival." Coats and other officials also contradicted Trump's positions on Iran, Afghanistan, and the Islamic State terror network.

"The Intelligence people seem to be extremely passive and naive when it comes to the dangers of Iran. They are wrong!" Trump responded. "When I became President Iran was making trouble all over the Middle East, and beyond. Since ending the terrible Iran Nuclear Deal, they are MUCH different, but a source of potential danger and conflict."

Ratcliffe, by contrast, appeared to be on the same page as the president. He grilled Mueller and Democrats at last week's congressional hearings, and told Fox News on Sunday that Mueller had effectively destroyed the presumption of innocence by saying Trump had not been "exonerated."

"By requiring Donald Trump to prove his innocence, they were depriving him of the one thing no one can be deprived of, which is a presumption of innocence," Ratcliffe said in an interview with Fox News' "Sunday Morning Futures."

Ratcliffe, who won re-election with more than 70 percent of the vote in his district in 2018, echoed that argument in the House Judiciary Committee hearings.

"The special counsel's job, nowhere does it say that you were to conclusively determine Donald Trump's innocence or that the special counsel report should determine whether or not to exonerate him," Ratcliffe told Mueller.

He added: "So, Americans need to know this as they listen to the Democrats and socialists on the other side of the aisle as they do dramatic readings from this report that Volume II of this report was not authorized under the law to be written. It was written to a legal standard that does not exist at the Justice Department and it was written in violation of every DOJ principle about extra prosecutorial commentary," he continued. "I agree with the chairman this morning when he said Donald Trump is not above the law. He’s not. But he damn sure shouldn’t be below the law, which is where Volume II of this report puts him."

A Republican former senator from Indiana, Coats was appointed director of national intelligence in March 2017, becoming the fifth person to hold the post since it was created in the wake of the attacks of Sept. 11, 2001, to oversee and coordinate the nation's 17 intelligence agencies.

CLICK HERE TO GET THE FOX NEWS APP

Coats had been among the last of the seasoned foreign policy hands brought in to surround the president after his 2016 victory, of whom the president steadily grew tired as he gained more personal confidence in Oval Office, officials said. That roster included Defense Secretary Jim Mattis and Secretary of State Rex Tillerson, and later, national security adviser H.R. McMaster.

Coats developed a reputation inside the administration for sober presentations to the president of intelligence conclusions that occasionally contradicted Trump's policy aims.

Fox News' John Roberts, Catherine Herridge, Chad Pergram, Gillian Turner and The Associated Press contributed to this report.