Apple is reportedly gearing up for a legal dispute over whether to unlock two phones used by the perpetrator of December’s shooting in Pensacola, Florida, in which three people were killed.

Attorney General William Barr asked Apple on Monday to provide access to the phones, but Apple declined. Apple faced a similar dispute in 2016 over access to a phone used by one of the shooters in the San Bernardino, California, terrorist attack.

According to The New York Times, Apple CEO Tim Cook has gathered advisers in preparation for a legal battle.

In a tweet sent Tuesday, Trump said Apple “will have step up to the plate and help our great Country” over the issue. Apple has said it was working with the FBI on the Pensacola case.

Visit Business Insider’s homepage for more stories.

Apple is said to be preparing to defy President Donald Trump and the Department of Justice in court over the thorny issue of whether it should unlock two iPhones used by a gunman last month.

The shooter opened fire at a Pensacola, Florida, naval base in early December, killing three people before dying in a shootout with the police.

On Monday, Attorney General William Barr asked Apple to provide access to two phones used by the shooter.

Yet Apple has refused to build a backdoor that would allow access, and, according to a report in The New York Times, the tech giant’s CEO Tim Cook is said to have gathered some top advisers for what could amount to a months-long legal clash. The goal, according to the Times, would be to avoid a prolonged confrontation but the firm is prepping for a legal fight just in case.

Publicly, Apple has said it is working with law enforcement on the Pensacola case, and disputed characterizations that it isn’t assisting in the investigation. Apple is also reported to be frustrated that the DOJ hasn’t spent enough time using third-party tools to try and unlock the phones.

Apple’s stance on refusing to compromise encryption on the iPhone jeopardizes Cook’s positive relationship with Donald Trump.

Lees ook op Business Insider €50.000 bij je ouders lenen voor een verbouwing: familiebank kan gunstig zijn, maar kunnen pa een ma een boeterente opleggen als het misgaat?

In a tweet sent Tuesday, Trump wrote: “We are helping Apple all of the time on TRADE and so many other issues, and yet they refuse to unlock phones used by killers, drug dealers and other violent criminal elements. They will have to step up to the plate and help our great Country, NOW! MAKE AMERICA GREAT AGAIN.”

Trump last month rubber-stamped a trade deal with China just two days before steep tariffs on many of Apple’s signature products were set to go into effect.

Apple has already fought the FBI over unlocking encrypted iPhones

This is not the first time Apple has faced legal disputes over its refusal to unlock iPhones used by criminals. In 2016, it faced a bitter, months-long stand-off with the FBI over whether or not to unlock the phone used by the perpetrator of the San Bernardino shooting.

Apple’s San Bernardino dispute was only resolved after a private company came forward with a way to unlock the killer’s phone.

Cook and Apple have long refused to build a so-called “backdoor” into its iPhones that would allow governments to access them in cases like criminal shootings, believing this would compromise user privacy.

The US government has argued it’s not up to Apple to refuse, with Barr arguing in an October speech that privacy is never an absolute right and can lawfully be violated where it’s “necessary to protect the safety of society as a whole.”

Apple and the Department of Justice did not immediately respond to requests for comment.