The director of the FBI says the agency paid more than $1 million for the hacking tool that thwarted the security features of the iPhone of a terrorist gunman in San Bernardino, California.

Speaking at a security forum Thursday in London, FBI Director James Comey declined to say exactly how much was paid for the solution, nor who developed it, but he disclosed that the amount was more than his total salary for the next seven years remaining in his term. The director makes $180,000 per year, which means the agency paid $1.26 million or more.

Apple and the Justice Department battled publicly for 43 days over Apple's refusal to hack into the phone. Apple defended its unwillingness to cooperate, saying that creating such a tool would force the company to weaken the security on its devices.

Comey said the publicity over their standoff "stimulated a bit of a marketplace" for breaking into the iPhone model that the FBI had in its possession.

"Somebody approached us from outside the government and said, ‘We think we've come up with a solution,’ " he said.

Once the solution was confirmed, the FBI dropped its suit against Apple. But Comey said he hopes the attention that the lawsuit generated will spark a broader discussion about how to resolve the ongoing tension between protecting people's digital privacy and giving law enforcement adequate tools to investigate threats.

"We have a problem where all of us share a set of values that are in conflict and we have to figure out how to resolve privacy and security on the internet and on our devices with public safety," Comey said.