By Jeff Mason

AUSTIN, Texas (Reuters) - U.S. President Barack Obama on Friday made a passionate case for mobile devices to be built in such a way as to allow government to gain access to personal data if needed to prevent a terrorist attack or enforce tax laws.

Speaking at the South by Southwest festival in Texas, Obama said he could not comment on the legal case in which the FBI is trying to force Apple Inc. to allow access to an iPhone linked to San Bernardino, California, shooter Rizwan Farook.

But he made clear that, despite his commitment to Americans' privacy and civil liberties, a balance was needed to allow some intrusion when needed.

"The question we now have to ask is: If technologically it is possible to make an impenetrable device or system where the encryption is so strong that there is no key, there's no door at all, then how do we apprehend the child pornographer, how do we solve or disrupt a terrorist plot?" he said.

"What mechanisms do we have available to even do simple things like tax enforcement because if in fact you can't crack that at all, government can't get in, then everybody is walking around with a Swiss bank account in their pocket."

The Justice Department has sought to frame the Apple case as one not about undermining encryption. A U.S. Federal Bureau of Investigation court order issued to Apple targets a non-encryption barrier on one iPhone.

The FBI says Farook and his wife were inspired by Islamist militants when they shot and killed 14 people on Dec. 2 at a holiday party in California. The couple later died in a shootout with police.

"Setting aside the specific case between the FBI and Apple, ... we’re going to have to make some decisions about how do we balance these respective risks," Obama said.

"My conclusion so far is you cannot take an absolutist view."

Obama was speaking at the South by Southwest festival in Austin about how government and technology companies can work together to solve problems including making it easier for people to vote.