US president Barack Obama has backed authorities in the debate pitting encryption and personal privacy against national security, saying authorities need access to data on electronic devices because the "dangers are real".

Mr Obama, appearing at an annual technology festival in Austin, Texas, delivered his most extensive comments to date on the issue being played out in court.

Apple, one of the world's largest technology companies, is challenging the US government's request that it help the FBI access data on a mobile phone used in the San Bernardino, California, attack that killed 14 people.

The issue has rocked the tech industry and divided Mr Obama's advisers, but the president seemed to side with law enforcement despite also saying the matter would not be settled by adopting an "absolutist view".

He restated his commitment to strong encryption but also raised the question of how authorities would catch child pornographers or disrupt terror plots if smartphones and other electronic devices were designed to keep their data locked away forever.

"My conclusion so far is that you cannot take an absolutist view on this," the president said.

"So if your argument is strong encryption, no matter what, and we can and should, in fact, create black boxes, then that I think does not strike the kind of balance that we have lived with for 200, 300 years.

"And it's fetishising our phones above every other value. And that can't be the right answer."

At the end of a nearly hour-long, question-and-answer session with Evan Smith, CEO and editor in chief of The Texas Tribune, Mr Smith asked the president "where do you come down?" on the privacy versus security debate. He was not asked to comment on the dispute with Apple.

Mr Obama said the government should not be able to "just willy nilly" access smartphones full of very personal data. But at the same time, while asserting that he was "way on the civil liberties side", he said "there has to be some concession" to be able to obtain the information in certain cases.

Apple and the government are embroiled in a legal fight over Apple's refusal to help the FBI access the iPhone used in San Bernardino.

The FBI has been unable on its own to unlock the phone and wants Apple to create a programme specifically for that phone to help the bureau get to the data on it. But Apple has refused, saying that would set a terrible precedent.

Congressman Darrell Issa, who has sharply questioned FBI director James Comey during congressional hearings on the matter, said Mr Obama's comments showed his "fundamental lack of understanding of the tech community, the complexities of encryption and the importance of privacy to our safety in an increasingly digital world".

Mr Issa said the solution, or key, that the government wanted Apple to create could be eventually compromised.

"There's just no way to create a special key for government that couldn't also be taken advantage of by the Russians, the Chinese or others who want access to the sensitive information we all carry in our pockets every day," he said.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.