The Justice Department is complaining that new encryption technology by Apple, Google and others makes it harder for police to gather evidence. Above, customers try Apple’s iPhone 6 in Beijing earlier this month.

The No. 2 official at the Justice Department delivered a blunt message last month to Apple Inc. executives: New encryption technology that renders locked iPhones impervious to law enforcement would lead to tragedy. A child would die, he said, because police wouldn’t be able to scour a suspect’s phone, according to people who attended the meeting.

At issue is new technology that Apple, Google Inc. and others have put in place recently to make their devices more secure. The companies say their aim is to satisfy consumer demands to protect private data.

But law-enforcement officials see it as a move in the wrong direction. The new encryption will make it much harder for the police, even with a court order, to look into a phone for messages, photos, appointments or contact lists, they say. Even Apple itself, if served with a court order, won’t have the key to decipher information encrypted on its iPhones.

The meeting last month ended in a standoff. Apple executives thought the dead-child scenario was inflammatory. They told the government officials law enforcement could obtain the same kind of information elsewhere, including from operators of telecommunications networks and from backup computers and other phones, according to the people who attended.

Technology companies are pushing back more against government requests for cooperation and beefing up their use of encryption. On Tuesday, WhatsApp, the popular messaging service owned by Facebook Inc., said it is now encrypting texts sent from one Android phone to another, and it won’t be able to decrypt the contents for law enforcement.

AT&T Inc. on Monday challenged the legal framework investigators have long used to collect call logs and location information about suspects.

In a filing to a federal appeals court in Atlanta, AT&T said it receives an “enormous volume” of government requests for information about customers, and argued Supreme Court decisions from the 1970s “apply poorly” to modern communications. The company urged the courts to provide new, clear rules on what data the government can take without a probable cause warrant.

Relations between the federal government and Silicon Valley have soured since revelations about government surveillance by National Security Agency leaker Edward Snowden —and the criticism of some technology companies that followed.

The new security measures threaten to alter the government’s post 9/11 efforts to intercept terrorists and other suspected law breakers. Last month, Federal Bureau of Investigation Director James Comey said new Apple and Google encryption schemes would “allow people to place themselves beyond the law.”

Robert Hannigan, the head of GCHQ, Britain’s version of the NSA, wrote in the Financial Times earlier this month that U.S. technology companies “have become the command-and-control networks of choice for terrorists and criminals, who find their services as transformational as the rest of us.”

As recently as 2012, Google Executive Chairman Eric Schmidt was on a first-name basis with then-NSA head Keith Alexander, published emails indicate. He and other Google executives participated in classified cybersecurity briefings on hacking threats facing the U.S.

In March, Mr. Schmidt declined a personal request by President Barack Obama for technical staffers from Google and the government to discuss what the NSA does and doesn’t do, according to two people familiar with the exchange.