AUSTIN, Texas (Reuters) - U.S. President Barack Obama on Friday made a passionate case for mobile devices to be built in a way that would allow the 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, the president said he could not comment on the legal case in which the Federal Bureau of Investigation 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 government intrusion if necessary.

“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.”

Last month, the FBI obtained a court order requiring Apple to write new software and take other measures to disable passcode protection and allow access to Farook’s iPhone.

Apple, which declined to comment on Obama’s remarks on Friday, has not complied. It said the government request would create a “back door” to phones that could be abused by criminals and governments, and that Congress has not given the Justice Department authority to make such a demand.

Obama’s comments were his most expansive on the subject since the dispute.

He acknowledged skepticism about the government in the wake of the revelations about U.S. surveillance programs by former National Security Agency contractor Edward Snowden.

But he pressed his point that a compromise that respected civil liberties and protected security had to be found. That solution would likely be a system with strong encryption and a secure “key” that is accessible to the “smallest number of people possible” for issues that were agreed to be important.

“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.”

Adding to his argument, the president listed airport security and stops for drunk drivers as examples of measures that were intrusive but accepted. He also warned against “fetishizing” phones.

“This notion that somehow our data is different and can be walled off from those other tradeoffs we make I believe is incorrect,” he said.

Top White House officials have lobbied the industry aggressively to work with the government on the issue, which was brought to a head by the California shootings.

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.