As Joseph Arpaio's federal case headed towards trial this year, US President Donald Trump wanted to act to help the former Arizona county sheriff who had become a campaign-trail companion and a partner in their crusade against illegal immigration.
The President asked Attorney-General Jeff Sessions whether it would be possible for the government to drop the criminal case against Arpaio, but was advised that would be inappropriate, according to three people with knowledge of the conversation. After talking to Sessions, Trump decided to let the case go to trial, and if Arpaio was convicted, he could grant clemency.
So the President waited, all the while planning to issue a pardon if Arpaio was found in contempt of court for defying a federal judge's order to stop detaining people merely because he suspected them of being undocumented immigrants. Trump was, in the words of one associate, "gung-ho about it".
"We knew the president wanted to do this for some time now and had worked to prepare for whenever the moment may come," said one White House official.
Trump's decision to issue his first pardon for Arpaio was the culmination of a five-year political friendship with roots in the "birther" movement to undermine President Barack Obama. In an extraordinary exercise of presidential power, Trump bypassed the traditional review process to ensure that Arpaio would face no time in prison.
Trump's pardon, issued without consulting the Justice Department, raised a storm of protest over the weekend. His effort to see if the case could be dropped showed a troubling disregard for the traditional wall between the White House and the Justice Department, and taken together with similar actions could undermine respect for the rule of law, experts said.
Arpaio faced up to six months in prison and was due to be sentenced in October. During his 23 years as Maricopa County sheriff, Arpaio was a lightening rod, in part because of his aggressive crackdown on illegal immigrants. He also was accused of racial profiling, failure to investigate sex crimes, poor treatment of prisoners and other instances of police misconduct.
Trump, in the space of four hours, also formally announced a ban on transgender people serving in the military and parted ways with polarising aide and conservative media darling Sebastian Gorka.
The announcements were made as Americans focused on Hurricane Harvey, giving new meaning to the news dump strategy that has long been a staple for Washington politicians looking to bury controversial decisions. And like many things with Trump, it was taken to an extreme.
Alex Conant, a Republican strategist, said: "Very little that Trump does surprises me any longer. He's proven to be very unpredictable and to not act within the norms of other politicians."