WASHINGTON -- Dan Coats, director of national intelligence, will leave his job next month, U.S. President Trump announced, after a turbulent two years in which Coats and the president were often at odds over Russian interference in the 2016 election.

Trump announced Coats' departure as Aug. 15 in a tweet on Sunday that thanked Coats for his service. He said he will nominate Rep. John Ratcliffe, R-Texas, to the post and that he will name an acting official in the coming days. Ratcliffe is a frequent Trump defender who fiercely questioned former special counsel Robert Mueller during a House Judiciary Committee hearing last week.

Coats often appeared out of step with Trump and disclosed to prosecutors how he was urged by the Republican president to publicly deny any link between Russia and the Trump campaign. The frayed relationship reflected broader divisions between the president and the government's intelligence agencies.

Coats' public, and sometimes personal, disagreements with Trump over policy and intelligence included Russian election interference and North Korean nuclear capabilities. Trump had long been skeptical of the nation's intelligence agencies, which provoked his ire by concluding that Russia interfered in the 2016 presidential election with the goal of getting him elected.

In a letter of resignation released Sunday night, Coats said serving as the nation's top intelligence official has been a "distinct privilege" but that it was time for him to "move on" to the next chapter of his life. He cited his work to strengthen the intelligence community's effort to prevent harm to the U.S. from adversaries and to reform the security clearance process.

A former Republican 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 Sept. 11, 2001, attacks to oversee and co-ordinate the nation's 17 intelligence agencies.

Coats had been among the last of the seasoned foreign policy hands brought 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 Defence 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.

His departure had been rumoured for months, and intelligence officials had been expecting him to leave before the 2020 presidential campaign season reached its peak.

Sen. Mark Warner of Virginia, the ranking Democrat on the Senate's intelligence committee, tweeted Sunday: "The mission of the intelligence community is to speak truth to power. As DNI, Dan Coats stayed true to that mission."

Senate Majority Leader Mitch McConnell said he was sorry to see Coats leave and praised him, saying he had been reassured knowing that such a man as his former Senate colleague who "took such a deliberate, thoughtful, and unbiased approach was at the helm of our intelligence community."

Trump's announcement that Coats would be leaving came days after Mueller's public testimony on his two-year investigation into Russian election interference and potential obstruction of justice by Trump, which officials said both emboldened and infuriated the president.

Coats had been among the least visible of the president's senior administration officials but, in his limited public appearances, repeatedly seemed at odds with the administration, including about Russia.

For instance, he revealed to 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.

Trump later called Coats to complain about the investigation and how it was affecting the government's foreign policy. Coats told prosecutors he responded that the best thing to do was to let the investigation take its course.

In February, he publicly cast doubt on the prospects of persuading North Korea to end its nuclear weapons program despite the diplomatic efforts of the administration, which has touted its outreach to the isolated country as one of its most important foreign policy achievements.

Coats, in testimony to Congress as part of annual national intelligence assessment, 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."

Trump publicly bristled at the testimony of Coats, the head of the CIA and other officials who contradicted his own positions on Iran, Afghanistan and the Islamic State group as well as North Korea. The intelligence officials were "passive and naive," he said in a tweet.

Last July, Coats and the president appeared at odds following Trump's widely panned news conference in Helsinki alongside Russian President Vladimir Putin. Trump said he saw no reason to believe Russia had interfered in the 2016 election, drawing bipartisan criticism and a rebuttal from his intelligence chief.

"We have been clear in our assessments of Russian meddling in the 2016 election and their ongoing, pervasive efforts to undermine our democracy, and we will continue to provide unvarnished and objective intelligence in support of our national security," Coats said.

The president later said he misspoke in Helsinki.

That same month, Coats appeared to scoff when told in an interview that Trump had invited Putin to Washington.

"Say that again," Coats said, cupping his hand over his ear on live television. He took a deep breath and continued: "OK. That's going to be special."

He later said his comments at the Aspen Security Forum in Colorado were "in no way meant to be disrespectful or criticize the actions of the president."

In December, Coats said he was "deeply saddened" when Mattis resigned in protest of Trump's foreign policy, including the decision to withdraw American troops from Syria. Coats called Mattis a "national treasure" who "will be sorely missed."

Coats, 76, served in Congress from 1981 to 1999 as a member of the House and in the Senate. He served as ambassador to Germany from 2001 to 2005 and returned to the Senate in 2011. He decided not to seek re-election and retired from Congress in January 2017.

In a tweet, Trump praised Ratcliffe: "A former U.S. Attorney, John will lead and inspire greatness for the Country he loves."

Ratcliffe, in his third term, is a relatively newer member of Congress and perhaps not as widely known as Coats was when he took the job. Confirmation takes a simple 51-vote majority, under new rules in the Senate, but that leaves slim room for error with Republicans holding a 53-seat majority.

Ratcliffe appeared Sunday on Fox News Channel's "Sunday Morning Futures" and made a number of points that were in sync with Trump's rhetoric. He said it was time to move on from talk of impeachment, questioned the legitimacy of the Mueller report into Russian election interference and urged investigation into potential wrongdoing during the Obama administration.

His remarks echoed his questioning of Mueller last week, in which the Texas Republican challenged the legal basis for the report's conclusions.

As a member of the House Judiciary Committee, Ratcliffe was heavily involved in a House GOP-led investigation last year about decisions "made and not made" by the Justice Department during the 2016 election. That probe questioned whether the department was biased against then-candidate Donald Trump and whether it abused surveillance powers as it began the Russia investigation. A former federal prosecutor, Ratcliffe was often one of the most aggressive questioners in closed-door depositions.

In early 2019, he was picked by House Republican leader Kevin McCarthy to sit on the House intelligence committee, as well. On Sunday, McCarthy called Trump's decision an "excellent nomination" and Ratcliffe "a man of character."

Oher Republican lawmakers such as Rep. Devin Nunes, the top Republican on the House's intelligence committee, also cheered the president's plan to nominate Ratcliffe. The California Republican tweeted that Ratcliffe "understands the intricacies of the intelligence community as well as civil liberties."

Democrats were cautious if not outright skeptical. Senate Democratic leader Chuck Schumer tweeted: "It's clear Rep. Ratcliffe was selected because he exhibited blind loyalty to @realDonaldTrump with his demagogic questioning of Mueller. If Senate Republicans elevate such a partisan player to a position requiring intelligence expertise & non-partisanship, it'd be a big mistake."