Image copyright Getty Images

Apple has accused the US government of trying to "smear" it with "desperate" and "unsubstantiated" claims.

It comes as the US Department of Justice (DOJ) renewed its demand for access to data on the iPhone used by San Bernardino gunman Rizwan Farook.

Apple is appealing against a court order that it unlock the iPhone, calling it "unprecedented".

But in its latest court filing, the DOJ claims Apple helped China's government to access more than 4,000 iPhones.

Farook and his wife killed 14 people in the Californian city last December before police fatally shot them.

'Liberty and rights'

The Federal Bureau of Investigations (FBI) wants Apple to create a so-called "back door" that would unlock Farook's iPhone. It says the phone may contain crucial evidence, but has been unable to break into it.

Apple has so far refused to comply with the court order, obtained last month. The company's chief executive, Tim Cook, has previously called the court order "dangerous", "chilling" and "unprecedented".

It has argued the government is asking for a security hack that could be exploited by both governments and criminals.

The DoJ said Apple's stance was "corrosive" to institutions trying to protect "liberty and rights".

Apple's lawyer, Bruce Sewell, told reporters that the tone of the latest DOJ court submission "reads like an indictment".

He said: "Everybody should beware because it seems like disagreeing with the Department of Justice means you must be evil and anti-American, nothing could be further from the truth."

Prosecutors claim Apple's own data shows that China demanded information from Apple regarding more than 4,000 iPhones in the first half of 2015, and Apple produced data 74% of the time.

But Mr Sewell said the new filing relied on thinly sourced news reports to inaccurately suggest that Apple had colluded with the Chinese government to undermine [iPhone] buyers' security.

The DOJ claimed in its court filing that Apple had attacked the FBI investigation as "shoddy" and tried to portray itself as a "guardian of Americans' privacy".

This "rhetoric is not only false, but also corrosive of the very institutions that are best able to safeguard our liberty and our rights: the courts, the Fourth Amendment, longstanding precedent and venerable laws, and the democratically elected branches of government", the DOJ said.

Support for Apple

Apple has appealed against the original court order, arguing that it violates the company's constitutional rights.

UN human rights chief backs Apple

Apple boss hits back at FBI conduct

McAfee offers to unlock iPhone for FBI

"This case is about the Department of Justice and the FBI seeking through the courts a dangerous power that Congress and the American people have withheld," Apple said.

The iPhone maker has received support from other tech giants including, Google, Microsoft, and Facebook.

The FBI says Farook and his wife, Tashfeen Malik, were inspired by Islamist militants when they killed 14 people at a party on 2 December.

The couple later died in a shootout with police and the FBI said it wants to read the data on Farook's work phone to investigate any links with militant groups.

A hearing into the case is scheduled for 22 March in a California federal court. Apple's Mr Cook has said he is willing to take the case to the Supreme Court.