SAN FRANCISCO — The tech industry is starting to line up with Apple in its fight against the federal government over the encryption it uses to keep iPhones secure.

“We stand with @tim_cook and Apple (and thank him for his leadership)!” Twitter chief executive Jack Dorsey wrote in a tweet Thursday afternoon.

In a statement late Thursday, Facebook said it condemns terrorism and also appreciates the essential work of law enforcement in keeping people safe. But it said it will “fight aggressively” against requirements for companies to weaken the security of their systems.

“These demands would create a chilling precedent and obstruct companies’ efforts to secure their products,” the statement said.

Google CEO Sundar Pichai had earlier voiced support for Apple in a series of tweets. “Forcing companies to enable hacking could compromise users’ privacy,” Pichai wrote on Wednesday, adding that the case “could be a troubling precedent.”

Apple’s recent iPhones use encryption security that Apple itself can’t unlock. The government isn’t asking Apple to help break the iPhone’s encryption directly, but to disable other security measures that prevent attempts to guess the phone’s passcode.

Apple CEO Tim Cook argues that once such a tool is available, “the technique could be used over and over again, on any number of devices.”