SAN FRANCISCO — Apple on Tuesday emphasized its opposition to a court order requiring it to help unlock an iPhone for law enforcement purposes, saying in a new legal brief that the government’s “methods for achieving its objectives are contrary to the rule of law, the democratic process and the rights of the American people.”

The company’s argument quickly drew a response from the Justice Department, which upbraided Apple for trying to stand above the law. “The Constitution and the three branches of the federal government should be entrusted to strike the balance between each citizen’s right to privacy,” a Justice Department spokeswoman, Emily Pierce, said in a statement. “The Constitution and the laws of the United States do not vest that power in a single corporation.”

The latest volleys between Apple and the Justice Department represent a final cementing of positions in a case that has pitted the world’s largest company against the government, which wants to extract data from an iPhone used by a gunman in the San Bernardino, Calif., terrorist attack last December. Apple has refused to comply with the order and its filing on Tuesday was the last before a crucial hearing in the case, which is scheduled for March 22 before Magistrate Judge Sheri Pym of the Federal District Court for the Central District of California.

The case has set off a fierce debate over privacy and security, with heated arguments between Apple and the government. Apple has contended that the court order could have grave consequences for digital security and privacy. The Justice Department has said Apple’s inability to get into its smartphones has created a system tailor-made for criminals.