Image copyright Reuters Image caption President Donald Trump at a campaign-style rally in Arizona on Tuesday

President Donald Trump was reportedly urged by advisers to restrain himself at a rally in Arizona on Tuesday from announcing a controversial pardon for former Arizona sheriff Joe Arpaio.

The president obliged, sort of. "You know what, I'll make a prediction: I think he's going to be just fine," he said, unable to resist.

"I won't do it tonight, because I don't want to cause any controversy... but Sheriff Joe should feel good."

Arpaio, 85, was found guilty of criminal contempt of court after he defied a court order to stop traffic patrols targeted at suspected immigrants. He's scheduled to be sentenced on 5 October.

Mr Trump's remarks were, to many, a pardon in all but paperwork.

According to CNN, that paperwork is already drawn up, as well as a list of talking points to send to Trump surrogates after it's signed. All that's needed is a signature.

But handily for a president who prefers to conduct business and shape policy by Twitter, he may not even need to pick up a pen. A few keystrokes on his Android phone could do the trick.

According to a 1929 Justice Department memo, obtained by USA Today: "Neither the constitution nor any statute prescribes the method by which Executive clemency shall be exercised or evidenced. It is wholly a matter for the President to decide, as a practical question of administrative policy."

It's unlikely that Alfred A Wheat, the acting solicitor general who prepared that memo for President Herbert Hoover, had Twitter in mind, but, not too long after Hoover's administration, presidents began using facsimile signatures on documents.

Harry Truman was the first president to use an autopen, a mechanical arm which replicates a signature from a computer memory. John F Kennedy made substantial use of the tool, according to the Smithsonian magazine, but only for run-of-the-mill correspondence and documents.

Barack Obama was the first president to use the autopen to sign a bill into law, planting his signature on a 2011 extension of the Patriot Act all the way from France.

So Donald Trump typing his name at the end of a tweet is, in some ways, just a natural evolution of the autopen. However, Mr Wheat did strongly recommend that any pardon not personally autographed by the president be countersigned by the attorney general.

The current Attorney General, Jeff Sessions, is on Twitter, so perhaps a retweet would suffice. Or a like.

Media playback is unsupported on your device Media caption In a 2011 interview, he said he was protecting American jobs

It was once law that a pardon did not take effect until a copy of the document reached the hands of the recipient.

One of Ulysses Grant's first acts as president was to cancel two pardons granted by his predecessor, Andrew Johnson, which fortunately for Grant had sat undelivered in a jailer's drawer.

That position was later abandoned by the Department of Justice, but the reasoning was used by the Department of Justice (DoJ) as recently as 2008, when George W Bush cancelled a pardon he had granted to a New York real estate developer and convicted fraudster Isaac Toussie. The pardon was signed, sealed, but not delivered.

Mr Wheat was also concerned in his memo about a pardon being forged.

"The important thing is to guard against the issue of spurious pardons," he wrote. His answer was that the pardoned man or woman be given "some token" of the pardon bearing the president's facsimile signature and "being certified by an official having charge of the records".

In the event of pardon-by-Twitter, an official could share the president's post with Arpaio, and vouch for it. But what about a forgery? If the president's Twitter account were hacked and the hacker issued a pardon - would it stand?

There's no precedent for that, and it remains "extremely unlikely", even under the President Trump, that a pardon would be issued by Twitter in the first place, said PS Ruckman, a professor of political science and editor of the Pardon Power Blog.

"I cannot conceive of a situation in which he would use Twitter to make the actual announcement, "I hereby pardon so and so," Mr Ruckman said. "He would in all likelihood follow the proper procedure."

That would involve signing a pardon document and delivering one copy to the DoJ and one to Arpaio.

The president's support for Arpaio has been highly controversial. It has been cheered by his anti-immigration base and criticised by his opponents as an endorsement of racial profiling.

The former sheriff's cause celebre was illegal immigration and he won national attention for his tough stance. He boasted of being "America's toughest sheriff" during his time as the elected lawman of Maricopa County, which includes the city of Phoenix.

He was known for round-ups of undocumented immigrants in Hispanic communities and for detaining people under suspicion simply for being Spanish speakers. He is also famous for opening an outdoor tent prison for immigrants, where inmates were required to wear pink underpants and socks.

An early and vocal Trump supporter, the former sheriff was also a proponent of the so-called "birther" conspiracy theory, fuelled by Mr Trump, which claimed President Barack Obama was not born in the US.