Apple has "an obligation" to protect user data and privacy, chief executive Tim Cook said Monday, reaffirming his stand in a high-profile court showdown with the US government on encryption.

Cook was speaking at an Apple product unveiling at the company's headquarters, one day before a court hearing on a hotly contested FBI effort to force the company to help break into the iPhone of a shooter involved in a deadly December attack.

"We need to decide as a nation how much power the government should have over our data and our privacy," Cook told the crowd gathered for the event.

"We believe strongly we have an obligation to help protect your data and your privacy. We owe it to our customers. We will not shrink from this responsiblity."

Cook's remarks were the latest in a battle with the US government over efforts to compel Apple to help the FBI break into the iPhone of one of the attackers in last year's deadly shooting rampage in San Bernardino, California.

READ: Apple ordered to hack San Bernardino shooter's iPhone

READ: Why even the FBI can't hack the iPhone

Apple, backed by a broad coalition of technology giants like Google, Facebook and Yahoo, argues that the FBI is seeking a "back door" into all iPhones as part of the probe into the December 2 massacre that left 14 people dead.

Because of the iPhone's encryption, Apple contends it would need to build a weaker operating system to help the FBI crack the phone's passcode.

The US Justice Department argues that it is making a "modest" demand that could help reveal vital evidence in a terror case.

An FBI victory could serve as a legal precedent backing requests for access to iPhones by law enforcement agencies throughout the United States.

A hearing was set for Tuesday before a magistrate in a federal court in Riverside, California. Whatever the decision, the ruling is likely to get additional hearings before the region's appeals court and possibly the US Supreme Court.