Donald Trump has defended his controversial pardon of former Arizona Sheriff Joe Arpaio by arguing a contempt of court charge "unfairly" cost Mr Arpaio his re-election bid.

Critics of the pardon, including leading congressional Republicans, have argued that the president was undermining the rule of law by overriding a court decision that found Mr Arpaio ignored federal orders to stop profiling Latinos. In explaining the decision, Mr Trump affirmed that his motive for clearing an early campaign ally was political.

“Sheriff Joe is a patriot, Sheriff Joe loves our country, Sheriff Joe protected our borders and Sheriff Joe was very unfairly treated by the Obama administration, especially right before an election, an election he would have won”, Mr Trump said during a press conference with Finnish President Sauli Niinisto.

A federal judge authorized the Department of Justice bringing a criminal contempt of court charge against Mr Arpaio in late October 2016. Two weeks later voters decisively rejected Mr Arpaio's bid for a seventh term, concluding a polarizing, decadeslong tenure for a man alternately hailed as a champion of law and order and despised for aggressively pursuing immigrants and paying out millions to settle lawsuits over profiling and jailhouse deaths.

Arizona boycotted over 'Nazi' purge of migrants Show all 3 1 /3 Arizona boycotted over 'Nazi' purge of migrants Arizona boycotted over 'Nazi' purge of migrants Demonstrations against Arizona's crackdown on illegal workers and in favour of immigration reform AP Arizona boycotted over 'Nazi' purge of migrants A protest march for federal immigration reform and against Arizona's controversial immigration law AP Arizona boycotted over 'Nazi' purge of migrants A rancher looks over the US-Mexico border at Montezuma Pass in Arizona GETTY IMAGES

Despite being repudiated by voters Mr Arpaio retains a steadfast ally in Mr Trump, who praised Mr Arpaio on Monday as "very strong on borders, very strong on illegal immigration". The former sheriff was an early proponent of Mr Trump's candidacy, which mirrored Mr Arpaio's focus on illegal immigration, and Mr Trump noted that pardoning Mr Arpaio energized his own base.

“The place went absolutely crazy when I was in Arizona last week”, Mr Trump said in reference to the roaring approval when he floated pardoning Mr Arpaio during a campaign-style rally in Phoenix last week.

Donald Trump attacks critics as rambling Phoenix rally speech descends into public meltdown

Mr Trump has also been rebuked for announcing his pardon of Mr Arpaio on Friday night, just as a powerful storm was descending on Texas. The president suggested that the timing ensured more people were paying attention.