Apple has said it will change iPhone settings to block a method used by police and intelligence agencies to break into devices.
The tech giant said it was aiming to protect all customers, especially those in countries where phones are routinely obtained by police or criminals.
Apple said it will change the default settings in the iPhone operating system to cut off communication through the charging port when a phone has not been unlocked for more than a hour.
Forensic companies use the port to get around the security provisions that limit how many password guesses can be made before the device freezes them out or erases data.
The change will mean that after the hour passes, the technique will no longer work.
Several forensic companies have been marketing their machines to law enforcement agencies around the world – selling them for thousands of dollars, and offering per-phone prices as low as $50 (£38).
In a statement, Apple said: "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.
“We have the greatest respect for law enforcement, and we dont design our security improvements to frustrate their efforts to do their jobs."
Apple began working on the issue before learning that it was being used by police.
Security researchers estimate that the changes to the iPhone's operating system code could cut access to devices by as much as 90%.
Apple has been a prominent opponent of demands from authorities for legislation to be created that forces technology companies to maintain access to users' devices.
More from Apple
In 2016, it went to court to fight an order that it break into an iPhone 5C used by a killer in San Bernardino.
The FBI ultimately found a contractor that broke into the phone without Apple's help.