Google CEO has backed Apple in its battle with FBI over opposing a US court's ruling to unlock the iPhone of a Pakistani-American terrorist who shot dead 14 people in California, saying forcing to enable hacking could "compromise" users' privacy.

In a series of tweets, Pichai said that although Google gives "law enforcement access to data based on valid legal orders", but it is "wholly different than requiring to enable hacking of customer devices and data," which could set a "troubling precendent".

"Forcing to enable hacking could compromise user's privacy," the Indian-American CEO said as he supported Apple CEO Tim Cook's stand.

"We know that law enforcement and intelligence agencies face significant challenges in protecting the public against crime and terrorism," Pichai said.

"We build secure products to keep your information safe and we give law enforcement access to data based on valid legal orders," he said.

"But that's wholly different than requiring companies to enable hacking of customer devices and data. Could be a troubling precedent," he said as debates are on on the merits of the case between Apple and federal law enforcement agencies.

Apple, which is eyeing big on the Indian market, yesterday opposed a US court's ruling to unlock the I-Phone of of San Bernardino gunman Syed Farook who shot dead 14 people and injured 22 others last December.

In an open letter to its customers, Cook said building a backdoor access to encrypted data on the iPhone of the gunman would be "too dangerous" to create.

Cook's response came after a federal judge ordered Apple to provide investigators access to Farook's iPhone after the company "declined to provide" it voluntarily.

The White House Press Secretary, Josh Earnest, has said this is one of request and this does not require Apple to redesign some element of its software, or to create a new backdoor.

"It's a very specific request that the Department of Justice has made, and a judge agreed with them," Earnest said.

Meanwhile, leading Republican presidential candidate Ted Cruz supported the FBI on the issue.

"I believe they (Apple) should (be compelled to enforce the court order)," the Texas Senator said during a CNN town hall.

"They have a binding search order. And, listen, any time you're dealing with issues of security, and civil liberties, you got to balance them both. I think we can walk and chew gum at the same time. We can protect yourself from terrorist, and also protect our civil rights," Cruz said.

Another presidential candidate, Marco Rubio, said,"Apple is under court order and I'm sure they're going to appeal it. They need to follow whatever the court order is ultimately.