Apple plans to change the default settings of its iPhone to stop hackers and others unlocking devices without proper legal authorization.
The move will also make it more difficult for police to unlock handsets without authorization.
However, Apple denied the changes were designed to thwart US law enforcement.
The loophole also applies to countries outside the US.
Police forces say that being able to unlock iPhones and iPads is crucial to their work.
But in 2016 Apple refused to help police unlock a phone used by a gunman who killed 14 people in San Bernardino, California.
"We're constantly strengthening the security protections in every Apple product to help customers defend against hackers, identity thieves and intrusions into their personal data," Apple said in a statement.
"We have the greatest respect for law enforcement, and we don't design our security improvements to frustrate their efforts to do their jobs."
The changes to the default settings of the iPhone are intended to stop unauthorized access to the phones via the USB port.
In 2016, a court order demanded that Apple help the FBI unlock the phone used by San Bernardino gunman Syed Rizwan Farook.
The company resisted and the FBI eventually paid experts to develop technology that unlocked the phone.
The FBI has never named the security firm or group of hackers who did the work.