President Donald Trump’s own top aides didn’t think he fully understood what he had done last Sunday, when he fired off a trio of racist tweets before a trip to his golf course.

After he returned to the White House, senior adviser Kellyanne Conway felt compelled to tell him why the missives were leading newscasts around the country, upsetting allies and enraging opponents.

Calling on four minority congresswomen – all citizens, three born in the United States – to “go back” to the “totally broken and crime infested places from which they came” had hit a painful historical nerve.

Trump defended himself. He had been watching “Fox & Friends” after waking up. He wanted to elevate the congresswomen, as he had previously discussed with aides.

The lawmakers – Reps. Ayanna Pressley of Massachusetts, Ilhan Omar of Minnesota, Alexandria Ocasio-Cortez of New York and Rashida Tlaib of Michigan – were good foils, he had told his advisers, including campaign manager Brad Parscale. The president said he thought he was interjecting himself into Democratic Party politics in a good way.

As is often the case, Trump acted alone – impulsively following his gut to the dark side of American politics, and now the country would have to pick up the pieces.

The day before, on the golf course, he hadn’t brought it up. Over the coming days, dozens of friends, advisers and political allies would work behind the scenes to try to fix the mess without any public admission of error, because that was not the Trump way.

“He realised that part of it was not playing well,” said Sen. Lindsey Graham, R-S.C., a Trump confidant, who golfed Saturday with the president and spoke to him about it on Monday. “Well, he always doubles down. Then he adjusts.”

Most shocking remarks made by Trump at campaign rallies Show all 7 1 /7 Most shocking remarks made by Trump at campaign rallies Most shocking remarks made by Trump at campaign rallies Doctors and mothers killing babies At a rally in Wisconsin in April 2019, Mr Trump made this extraordinary claim. “The baby is born, the mother meets with the doctor, they take care of the baby,” Mr Trump said. “They wrap the baby beautifully and then the doctor and the mother decide whether they will execute the baby” Getty Most shocking remarks made by Trump at campaign rallies "China rapes our country" At a rally in Fort Wayne, Indiana in 2016, Mr Trump said this in reference to the US trade deficit with China: "we can’t continue to allow China to rape our country and that’s what they’re doing. It’s the greatest theft in the history of the world" Getty Most shocking remarks made by Trump at campaign rallies "EU formed to take advantage of US" At a rally for the midterm elections in October 2018, Mr Trump called the EU a "brutal" alliance that "formed to take advantage of us" AFP/Getty Most shocking remarks made by Trump at campaign rallies "I will build a wall and Mexico will pay for it" Mr Trump first made this claim at the launch of his presidential campaign back in 2015: "I will build a great, great wall on our southern border, and I will have Mexico pay for that wall. Mark my words" AFP/Getty Most shocking remarks made by Trump at campaign rallies "Horrible, horrendous people" At a Republican rally in Pennsylvania on August 3 2018, President Trump deemed all journalists in attendance "horrible, horrendous people". He later denounced the "fake, fake, disgusting news" for falsely reporting that he was late to his meeting with the Queen when visiting Britain AFP/Getty Most shocking remarks made by Trump at campaign rallies "I could stand in the middle of Fifth Avenue and shoot somebody" Mr Trump said this in reference to his popularity during a rally in Iowa in 2016 AFP/Getty Most shocking remarks made by Trump at campaign rallies "I wish I could punch him" Mr Trump said this in reference to a protester who was escorted out of his rally in Las Vegas on 22 February, 2016. There was often violence between protesters and supporters at Trump's campaign rallies AFP/Getty

Like others, Graham urged Trump to reframe away from the racist notion at the core of the tweets – that only European immigrants or their descendants are entitled to criticise the country.

Advisers wrote new talking points and handed him reams of opposition research on the four congresswomen. Pivot to patriotism. Focus on their ideas and behaviour, not identity. Some would still see a racist agenda, the argument went, but at least it would not be so explicit.

“The goal is to push back against them and make it not about you,” Graham said.

The damage control did not save elected Republicans from their chronic struggle to navigate Trump’s excesses. Democrats were demanding a reckoning, a vote on the floor of the House condemning his racist remarks that would showcase their own unity and moral vision. The White House would mobilise an intense whip operation, putting Trump repeatedly on the phone, to keep his members in line.

Then, just as many felt the firestorm was coming under control, Trump’s own supporters would set it ablaze again, with a “Send her back!” chant at a Wednesday night rally in Greenville, North Carolina, inspired by the president’s own words.

This account of Trump’s tweets and their aftermath is based on interviews with 26 White House aides, advisers, lawmakers and others involved in the response – most of whom spoke on the condition of anonymity to share behind-the-scenes details.

The political crisis was both familiar and extraordinary – engulfing every aspect of American politics, from the presidential campaign to the White House to Capitol Hill. Many in both parties, well acquainted with Trump’s history of racially charged rhetoric, were stunned at how far he had gone this time.

Republicans were fearful of the potential damage but reluctant to confront or contradict Trump. The White House and the Trump campaign sought to contain the furore without alienating key supporters. Democrats finally unified after a week of squabbling to roundly condemn the president.

And at key moments, there were attempts to pretend it hadn’t happened at all. When Senate Majority Leader Mitch McConnell, R-Ky., talked to Trump on Sunday and Monday about ongoing budget negotiations, the tweets never even came up, according to a person familiar with the conversations.

In the end, Trump succeeded in at least one respect. Just a few days earlier, he had publicly pined for the days when he could put out a tweet that took off “like a rocket.” Now he had done it again. Americans had to choose sides, and he had drawn the dividing line.

When Trump woke up to tweet on July 14, the nation’s leadership was scattered, its attention focused elsewhere.

Acting White House Chief of Staff Mick Mulvaney was out of state. House Speaker Nancy Pelosi, D-Calif., had flown back home to San Francisco. The leaders of the House Republican caucus, Reps. Kevin McCarthy of California and Steve Scalise of Louisiana, were at a fundraising retreat at the Nemacolin Woodlands Resort in Pennsylvania.

Of the group, only Ms Pelosi, who sleeps just a handful of hours most nights, acted quickly. Trump’s tweets landed about 4:30 a.m. on the West Coast. Within three hours, just as Trump was arriving at his Virginia golf club, she had condemned his words on Twitter, calling out the racial tone directly, saying Trump’s “plan to ‘Make America Great Again’ has always been about making America white again.”

Trump was roundly condemned as his supporters chanted ‘send them back’, referencing the four congresswomen he attacked with a racist tweet, at his rally earlier this week (Zach Gibson/Getty Images) (Getty)

Trump’s eruption gave her a chance to move beyond an irritating, and increasingly personal, split with the four congresswomen. They had been furious when Ms Pelosi and the rest of the Democratic caucus declined to follow their guidance on a recent immigration funding vote. Now they were united.

At a joint news conference by the four lawmakers late Monday, Omar said Trump’s tweets represented “the agenda of white nationalists.”

Democratic candidates for president reacted quickly with outrage and offered support for the embattled House lawmakers.

Sen. Kamala Harris of California, the child of an Indian mother and a Jamaican father, told her campaign staff that she had been targeted by the same “go home” attack. In an emotional response at an Iowa event Tuesday, Harris said Trump had “defiled” his office and “it has to stop.”

“I am going to tell you what my mother told me: ‘Don’t you ever let anyone tell you who you are. You tell them who you are. Period,’ “ Harris said, growing visibly angry as she spoke. “We are Americans, and we will speak with the authority of that voice.”

Trump’s own campaign, by contrast, was caught off guard by the tweets and didn’t know initially how to respond. Top aides had been bragging about their ability to fundraise and capitalise on social media advertising when the president blew up a news cycle. But they placed no Facebook ads to ride this wave. The Republican National Committee was silent for more than a day. No one wanted to touch it, advisers said.

“People have been through so many of these with him,” said one Republican involved in the fight.

Cliff Sims, a former West Wing aide to Trump, explained the mentality that still governs the building. “The people who thrive and survive over the long-term are the ones who are OK with going where the president leads,” he said.

But as the workweek began, it became clear that the uproar could not be ignored. A person involved in the president’s fundraising effort said many donors were dismayed by the comments – but that there was scant desire to back away from the president publicly.

“You put your head up, and you get it cut off,” this person said. “And then everyone remembers you weren’t loyal when this blows over.”

Many Republican lawmakers demurred or tried to find a middle ground, avoiding direct criticism of Trump while nonetheless expressing face-saving dissatisfaction. “We should focus on ways to bring people together,” said Sen. Cory Gardner, who faces a tough re-election race next year in Colorado.

Inside the weekly Republican lunch on Tuesday, GOP leaders tried to avoid direct references to Trump’s racist comments. McConnell repeated a phrase famously uttered by the late Supreme Court justice Antonin Scalia, a figure he reveres: “I attack ideas. I don’t attack people.”

Stephen Colbert says racism is Trump’s ‘brand’ in scathing video

One effusive Trump ally, Senator Steve Daines, R-Mont., spoke up in defence of Trump inside the lunch, ticking off a litany of conservative grievances against the left, such as their attacks against immigration enforcement and comments perceived as anti-Semitic.

“Let’s not lose sight of, frankly, the radical views that are coming out of the House,” Mr Daines said in an interview, describing his message to the other Republican senators.

Still, other GOP senators were uneasy. At a minimum, it was “dumb politics,” said one senior GOP senator, speaking on the condition of anonymity to be candid about the president’s tweet.

Two of the harshest Republican push backs came, tellingly, from the only two elected black Republicans serving in Congress. Sen. Tim Scott of South Carolina called the tweets “racially offensive.”

“There is no room in America for racism, sexism, anti-Semitism, xenophobia and hate,” said Rep. Will Hurd of Texas.

By midday Monday, the Republican battle to minimise the damage was unfolding on two fronts. The first was an effort to get Trump to shift his message, without admitting a mistake. The goal, said one senior White House aide, was to “get the message back to a place where we could defend the president.”

Trump tweeted telling the four BAME Democrat congresswomen, colloquially known as ‘the squad’, to ‘go back to where they came from’ (EPA)

The idea was to argue that the four congresswomen hated America and were welcome to leave for that reason. There were other lines of attack as well. Omar had been condemned earlier in the year for a series of comments criticising support for Israel that many Democrats considered anti-Semitic. Ms Pressley had seemed to suggest a racial litmus test for politics, saying Democrats don’t need “any more black faces that don’t want to be a black voice.”

Privately, allies of the president said there was advantage in elevating “The Squad,” a term the lawmakers had adopted for themselves that Republicans have derided. They hoped to use the feud to portray re-electing the president as the patriotic thing to do.

“We’re talking about four congresswomen that have pretty extreme views,” Graham said. “If that’s the face of the Democratic Party we’re in pretty good shape.”

On Capitol Hill, Republican leaders settled on a similar way to frame the disaster.

“I want to make absolutely clear that our opposition to our socialist colleagues has absolutely nothing to do with their gender, with their religion, or with their race,” said Rep. Liz Cheney of Wyoming, chair of the House Republican Conference.

Democrats, by now, were focused on making sure the nation did not forget Trump’s original message. Ms Pelosi had begun working on a resolution of disapproval Sunday night in conversations with Reps. Jamie Raskin of Maryland and Tom Malinowski of New Jersey. They had already introduced a resolution in April condemning white-supremacist terrorism, which was now repurposed.

But first they had to manage an unruly caucus, which began to jockey over the resolution’s language. At least one member pushed for a more aggressive resolution that would censure Trump. Another proposed inserting language commemorating the 50th anniversary of the Apollo 11 moon landing.

The White House vote-counters initially feared as many as 50 Republicans might defect to support the resolution, and Trump ordered an all-hands White House effort to keep the GOP caucus together. White House aides told allies on the Hill that it was OK to criticise Trump, as long as they didn’t vote with Democrats.

Trump was obsessed with the vote tally and received regular briefings. Aides fed him a constant stream of lawmaker reactions and put him on the phone himself with several lawmakers. He told his team to tell any wafflers that he loves America and that they needed to pick sides. Trump called McCarthy to cancel an immigration meeting planned at the White House on Tuesday.

“Stay there and fight,” he told McCarthy.

Vice President Mike Pence also worked the phones, telling Republican members not to fall for a Democratic trap.

In the end, only four Republicans broke ranks, including Will Hurd. Key members from districts where Trump’s “go home” message would play terribly stuck with the president. They included two members from New York, John Katko and Elise Stefanik, and Mario Diaz-Balart, the son of Cuban immigrants, whose Florida district is 76% Hispanic.

Mr Trump sparked a storm after tweeting that four BAME Democratic congresswomen should “go back” to their countries, despite the fact they are all US citizens (Image: Chip Somodevilla/Getty Images) (Getty)

“A statement does not make one racist,” he told reporters.

While they lobbied in private, Republican leaders also began looking for a way to regain the narrative in public, at least in a way that could play with the conservative base.

When Ms Pelosi came to the floor to read the words of the resolution, calling Trump’s comments racist – not Trump himself, despite what Diaz-Balart argued – Republicans saw an opening.

Their vehicle was an obscure text, Thomas Jefferson’s Manual of Parliamentary Practice, a rule book that had governed the House floor since 1837. Based on old British traditions of respecting the king, an updated version of the manual specifically said the president could not be accused of making a racist statement, regardless of the accuracy of the allegation.

Emanuel Cleaver II – a United Methodist pastor and respected figure in the caucus – was up on the dais, tasked specifically by Ms Pelosi to manage the debate. The chamber seemed close to finishing without incident when Rep. Douglas Collins, R-Ga., stood up to ask that Ms Pelosi’s words be struck from the record by the parliamentarian.

Flashing through the Missouri congressman’s mind as he grew frustrated with Republican maneuvers were times he had been subjected to the same racist trope the president had tweeted, he said in an interview.

“I’m sick of this mess,” Cleaver recalled thinking. “In theology, we say the devil has two favourite tools: disunity and division. . . . I see people running around, the devil running around here, having fun. . . . I’m just thinking he’s just having a ball and using people to get delight.”

So, Cleaver announced, “I abandon the chair,” dropped the gavel and abruptly left the dais.

It didn’t matter that the president himself had said Ms Pelosi’s response to him was “racist” just a day earlier, or that House rules still allowed the sentiment to be passed into law. Republicans finally had a way to cast themselves as the victims of an out-of-control Democratic leadership.

“Democrats are just so blinded by their hatred of the president that they use every single tool at their disposal to harass him,” said Chris Pack, communications director of the National Republican Congressional Committee. “And it’s getting really pathetic.”

By the time Trump landed in Greenville, North Carolina, on Wednesday evening, the mood had lifted in the White House and Republicans believed the worst was behind them. A White House aide urged the travelling press pool to be sure to “tune in” to the rally, implying it was not something they would want to miss.

“You can take issue with his tactics,” said Josh Holmes, a close adviser to McConnell. “But the reality is that there is no political figure in memory who consistently saddles his opponents with unwinnable arguments quite like President Trump.”

But the nuance of Trump’s shifts all week had been lost on many in the crowd of thousands at the East Carolina University auditorium. Midway through his speech, as he recounted his denunciation of Omar’s record, the crowd began to chant “Send her back!,” a paraphrase of his own tweeted “go back.”

Donald Trump says he 'likes' Boris Johnson

He paused for about 13 seconds to let the chants wash over him.

Back in Washington, and even for some Republicans in the room, it was a nightmare scenario suggesting that the nativism at the heart of Trump’s Sunday tweet – that nonwhite citizens had less claim on the country – would soon become a fixture of the campaign.

The following morning, Republican leaders, including McCarthy and Cheney, huddled at the vice president’s residence to figure out how to deal with the danger of the chant catching on. Pence agreed to take the matter to the president.

Matt Brooks, the executive director of the Republican Jewish Coalition, a group that had hosted Trump at its convention in April, also spoke out. The chants, he wrote on Twitter, were “vile” and “have no place in our society.”

Others in the White House began to reconsider the emerging strategy of using Omar’s own record as a rallying cry for the base.

Trump agreed to say the chants were wrong – but few thought that would be the end of it.

Indeed, by Friday, he was attacking the four lawmakers again, suggesting that no criticism of the country should be tolerated and praising the rally chanters he had distanced himself from just a day earlier. “Those are incredible people. Those are incredible patriots,” he said.

There was little sign, in other words, that Trump had been cowed by the week’s experience.

At one point during the North Carolina rally, the president mused about Pressley’s remarks on race, which he characterised as thinking “that people with the same skin colour all need to think the same.”

“And just this week – can you imagine if I said that? It would be over, right?” Trump continued. “. . . But we would find a way to survive, right? We always do. Here we are. Here we are. We find a way. Got to always find a way.”