Image copyright Getty Images Image caption Apple chief executive Tim Cook and Donald Trump don't see eye to eye over access to data

US President Donald Trump has launched a fresh attack on Apple.

He tweeted that the company was refusing to unlock iPhones "used by killers, drug dealers and other violent criminal elements".

On Monday US Attorney General William Barr accused Apple of not being helpful in an inquiry into a shooting that is being treated as a terrorist act.

It is the latest in a series of clashes between the White House and technology giants over access to data.

Mr Trump accused Apple of refusing to co-operate with investigators despite his administration helping the company on trade and other issues.

The president's comments came a day after Mr Barr said Apple had failed to provide "substantive assistance" to unlock two iPhones in an investigation into a fatal shooting at a naval base in Pensacola, Florida.

Three US sailors were killed when a Saudi trainee at the base opened fire on 6 December.

Apple said it rejected the claim that it had failed to help officials in their investigation.

"Our responses to their many requests since the attack have been timely, thorough and are ongoing," it said in a statement.

This is not the first time Apple has clashed with the US justice department. After a mass shooting in San Bernardino, California in 2015, in which 14 people were killed and 22 others were seriously injured, Apple refused to help gain access to the gunman's iPhone.

The US government ended up paying another company a reported $1m (£770,000) to develop software to get around the device's encryption.

The disputes highlight the ongoing disagreement between the technology industry and law enforcement agencies around the world.

On one side encryption plays a crucial role in protecting people's privacy, on the other it can cause major issues for criminal investigators.