A senior US intelligence official told lawmakers last week that Russia wants to see president Donald Trump re-elected, viewing his administration as more favourable to the Kremlin's interests, according to people who were briefed on the comments.

After learning of that analysis, which was provided to House of Representatives lawmakers in a classified hearing, Mr Trump erupted at his acting director of national intelligence, Joseph Maguire, in the Oval Office, perceiving him and his staff as disloyal for speaking to congress about Russia's perceived preference.

The intelligence official's analysis and Mr Trump's furious response ruined Mr Maguire's chances of becoming the permanent intelligence chief, according to people familiar with the matter, who, like others, spoke on the condition of anonymity to discuss a sensitive matter.

It was not clear what specific steps, if any, US intelligence officials think Russia may have taken to help Mr Trump, according to the individuals.

Mr Trump announced on Wednesday that he was replacing Mr Maguire with a vocal loyalist, Richard Grenell, who is the US ambassador to Germany. The shake-up at the top of the intelligence community is the latest in a post-impeachment purge. Mr Trump has instructed aides to identify and remove officials across the government who aren't defending his interests, and he wants them replaced with loyalists.

Mr Maguire, a career official who is respected by the intelligence rank and file, had been considered a leading candidate to be nominated for the post of Director of National Intelligence (DNI), White House aides had said. But Mr Trump's opinion shifted last week when he heard from a GOP ally about the official's remarks.

The Democrat challengers to Trump in 2020 Show all 25 1 /25 The Democrat challengers to Trump in 2020 The Democrat challengers to Trump in 2020 Bernie Sanders The Vermont senator has launched a second bid for president after losing out to Hilary Clinton in the 2016 Democratic primaries. He is running on a similar platform of democratic socialist reform Getty The Democrat challengers to Trump in 2020 Joe Biden The former vice president recently faced scrutiny for inappropriate touching of women, but was thought to deal with the criticism well and has since maintained a front runner status in national polling EPA The Democrat challengers to Trump in 2020 Elizabeth Warren The Massachusetts senator is a progressive Democrat, and a major supporter of regulating Wall Street Reuters The Democrat challengers to Trump in 2020 Amy Klobuchar Klobuchar is a Minnesota senator who earned praise for her contribution to the Brett Kavanaugh hearings Getty The Democrat challengers to Trump in 2020 Michael Bloomberg Michael Bloomberg, a late addition to the 2020 race, announced his candidacy after months of speculation in November. He has launched a massive ad-buying campaign and issued an apology for the controversial "stop and frisk" programme that adversely impacted minority communities in New York City when he was mayor Getty Images The Democrat challengers to Trump in 2020 Tulsi Gabbard The Hawaii congresswoman announced her candidacy in January, but has faced tough questions on her past comments on LGBT+ rights and her stance on Syrian President Bashar al-Assad Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Pete Buttigieg The centrist Indiana mayor and war veteran would be the first openly LGBT+ president in American history Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Deval Patrick The former Massachusetts governor launched a late 2020 candidacy and received very little reception. With just a few short months until the first voters flock to the polls, the former governor is running as a centrist and believes he can unite the party's various voting blocs AFP/Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Beto O'Rourke The former Texas congressman formally launched his bid for the presidency in March. He ran on a progressive platform, stating that the US is driven by "gross differences in opportunity and outcome" AP The Democrat challengers to Trump in 2020 DROPPED OUT: Kamala Harris The former California attorney general was introduced to the national stage during Jeff Sessions’ testimony. She has endorsed Medicare-for-all and proposed a major tax-credit for the middle class AFP/Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Bill De Blasio The New York mayor announced his bid on 16 May 2019. He emerged in 2013 as a leading voice in the left wing of his party but struggled to build a national profile and has suffered a number of political setbacks in his time as mayor AFP/Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Steve Bullock The Montana governor announced his bid on 14 May. He stated "We need to defeat Donald Trump in 2020 and defeat the corrupt system that lets campaign money drown out the people's voice, so we can finally make good on the promise of a fair shot for everyone." He also highlighted the fact that he won the governor's seat in a red [Republican] state Reuters The Democrat challengers to Trump in 2020 DROPPED OUT: Cory Booker The New Jersey Senator has focused on restoring kindness and civility in American politics throughout his campaign, though he has failed to secure the same level of support and fundraising as several other senators running for the White House in 2020 Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Wayne Messam Mayor of the city of Miramar in the Miami metropolitan area, Wayne Messam said he intended to run on a progressive platform against the "broken" federal government. He favours gun regulations and was a signatory to a letter from some 400 mayors condemning President Trump's withdrawal from the Paris Climate Accord Vice News The Democrat challengers to Trump in 2020 DROPPED OUT: Kirsten Gillibrand The New York Senator formally announced her presidential bid in January, saying that “healthcare should be a right, not a privilege” Getty The Democrat challengers to Trump in 2020 DROPPED OUT: John Delaney The Maryland congressman was the first to launch his bid for presidency, making the announcement in 2017 AP The Democrat challengers to Trump in 2020 DROPPED OUT: Andrew Yang The entrepreneur announced his presidential candidacy by pledging that he would introduce a universal basic income of $1,000 a month to every American over the age of 18 Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Julian Castro The former San Antonio mayor announced his candidacy in January and said that his running has a “special meaning” for the Latino community in the US Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Marianne Williamson The author and spiritual adviser has announced her intention to run for president. She had previously run for congress as an independent in 2014 but was unsuccessful Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Eric Swalwell One of the younger candidates, Swalwell has served on multiple committees in the House of Representatives. He intended to make gun control central to his campaign but dropped out after his team said it was clear there was no path to victory Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Seth Moulton A Massachusetts congressman, Moulton is a former US soldier who is best known for trying to stop Nancy Pelosi from becoming speaker of the house. He dropped out of the race after not polling well in key states Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Jay Inslee Inslee has been governor of Washington since 2013. His bid was centred around climate change AFP/Getty The Democrat challengers to Trump in 2020 DROPPED OUT: John Hickenlooper The former governor of Colorado aimed to sell himself as an effective leader who was open to compromise, but failed to make a splash on the national stage Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Tim Ryan Ohio representative Tim Ryan ran on a campaign that hinged on his working class roots, though his messaging did not appear to resonate with voters Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Tom Steyer Democratic presidential hopeful billionaire and philanthropist Tom Steyer is a longtime Democratic donor AFP/Getty

The official, Shelby Pierson, said several times during the briefing that Russia had “developed a preference” for Mr Trump, according to a US official familiar with her comments. That conclusion was part of a broader discussion on election security that also touched on when the US government should warn Democratic candidates that they were being targeted by foreign governments.

The New York Times first reported on the conclusion that Russia wants to help the president in 2020.

Mr Trump erroneously believed that Ms Pierson had given the assessment exclusively to Representative Adam Schiff, Democrat for California, the committee chairman, people familiar with the matter said. Mr Trump also believed that the information would be helpful to Democrats if it were released publicly, the people said. Representative Schiff was the lead impeachment manager, or prosecutor, during Mr Trump's senate trial on charges of abuse of power and obstruction of congress.

Mr Trump learned about Ms Pierson's remarks from Representative Devin Nunes, Republican for California, the committee's ranking member and a staunch Trump ally, said one person familiar with the matter. Mr Trump's suspicions of the intelligence community have often been fuelled by Mr Nunes, who was with the president in California on Wednesday when he announced on Twitter that Mr Grenell would become the acting director, officials said.

A spokesman for Mr Nunes did not respond to requests for comment.

“Members on both sides participated, including ranking member Nunes, and heard the exact same briefing from experts across the intelligence community,” the committee official said. “No special or separate briefing was provided to one side or to any single member, including the chairman.”

The briefing, which was offered to all members of the committee, covered “election security and foreign interference in the run-up to the 2020 election”, said the committee official.

Other people familiar with the briefing described it as a contentious re-litigating of a previous intelligence assessment that Russia interfered in 2016 to help Mr Trump. Republican members questioned why the Russians would want to help Mr Trump when he has levied punishing sanctions on the country, and they challenged Ms Pierson to back up her claim with evidence. It's unclear how she responded.

Republicans on the committee also accused some of the briefers from other agencies of being part of an effort to sabotage Mr Trump's reelection, these people said.

Donald Trump shakes hands with Russian president Vladimir Putin during a bilateral meeting on the sidelines of the G-20 summit in Osaka, Japan 28 June 2019 (Susan Walsh/AP)

Mr Trump became angry with Mr Maguire and blamed him for Ms Pierson's remarks when the two met the next day during a special briefing for Mr Trump on election security attended by officials from other agencies, but not Ms Pierson.

At that briefing, Mr Trump angrily asked Mr Maguire why he had to learn of what Ms Pierson had said from Mr Nunes and not from his own aides, according to the US official.

“There was a dressing down” of Mr Maguire, said another individual, who, like others, spoke on the condition of anonymity to discuss a sensitive matter. “That was the catalyst” that led to the sidelining of Mr Maguire in favor of Mr Grenell, the person said. Mr Maguire came away “despondent,” said another individual.

A spokeswoman for the Office of the Director of National Intelligence declined to comment. The White House did not comment on Mr Trump's Oval Office comments to Mr Maguire.

Mr Trump's removal of Maguire exacerbated long-standing tensions between intelligence officials and the president. Intelligence leaders have long been some of Mr Trump's favourite targets on Twitter and at campaign rallies, where he portrays them as members of a “deep state” bent on sabotaging his re-election.

But officials at the agencies insist they have carried on the tradition of providing the president and his top aides with unvarnished information not infected by politics or policy agendas.

Mr Grenell has no lengthy intelligence experience. But his history of pro-Trump tweets and his personal relationships with Mr Trump's children has caused current and former officials to doubt whether he could credibly serve as the country's top intelligence official, which they said Mr Maguire did, despite having spent his career in the military.

White House officials said that Mr Trump's decision to make Mr Grenell the acting director, rather than nominate him for the permanent position, reflected concerns that he might not win confirmation in the senate given his polarising reputation. “The president likes acting [officials] better,” one White House official said.

On Thursday, Mr Grenell said in a tweet that the president would nominate a permanent Director of National Intelligence (DNI) “soon” and that it would not be him. A senior White House official said a nominee would be announced before 11 March.

The president has been focused lately on officials who are allegedly disloyal to him, particularly at the Justice Department, the National Security Council, the Pentagon and the State Department, aides said, and has heard from outside advisers that “real MAGA people can't get jobs in the administration”, in the words of an administration official, referring to Mr Trump's 2016 campaign slogan, “Make America Great Again”.

Mr Trump has centralised his efforts to purge the ranks of his perceived opponents. In recent weeks, he pushed out Sean Doocey, the head of the White House Presidential Personnel Office, over the fierce objections of some White House aides, replacing him with Johnny McEntee, Mr Trump's former personal assistant. Mr Trump has instructed McEntee, who lost his job in 2018 over concerns about his online gambling, to install more loyalists in government positions.

Some of those removed from their jobs testified about the president's actions toward Ukraine during his impeachment hearings.

Acting national intelligence director Joseph Maguire who is to be replaced by Trump loyalist Richard Grenell (Matt McClain/The Washington Post)

Mr Trump removed Lt Col Alexander Vindman, as well as Mr Vindman's twin brother, who did not testify, from their positions at the National Security Council. Lt Col Vindman witnessed a phone call Mr Trump had with Ukraine's president, in which he pressured the leader to conduct investigations of Mr Trump's Democratic rivals.

Mr Trump asked for the resignation of Gordon Sondland, the ambassador to the European Union, who told House lawmakers that the president had engineered a quid pro quo with Ukraine, conditioning a White House meeting with the country's president on investigations of former vice president Joe Biden and his son Hunter.

This week, Mr Trump also asked for the resignation of John C Rood, the official in charge of Defence Department policy who had certified that Ukraine had met its anti-corruption obligations required by law to receive US aid that Mr Trump froze.

The deputy national security adviser, Victoria Coates, has also been removed from her post after some colleagues, including trade adviser Peter Navarro, accused her of being the author of “Anonymous”, a scathing account of dysfunction in the White House, according to people familiar with the matter. Ms Coates has strenuously denied the charge. She was moved to an adviser position in the Energy Department.

By contrast, Mr Grenell appears to be an ideal presidential appointee. Mr Trump appreciates that he publicly bashes Germany over policy disagreements. He also defends the president on Fox News and on Twitter, and when he visits the White House for meetings, Mr Trump usually wants to see him, current and former administration officials say.

As acting DNI, Mr Grenell would oversee the intelligence community's efforts to combat election interference and disinformation, but he has been skeptical of Russia's role in 2016.

“Russian or Russian-approved tactics like cyber warfare and campaigns of misinformation have been happening for decades,” he wrote in a 2016 opinion article for Fox News, playing down the severity of the threat. That view is at odds with the conclusions of senior US intelligence officials, who have said Russia's operation in 2016 was sweeping and systematic, and unlike previous Russian or Soviet efforts.