Gangs had threatened to kill an officer every two days until Mr Orduna quit
The chief of police in Mexico's most violent city, Ciudad Juarez, has stepped down amid ongoing threats.
Roberto Orduna stepped down hours after a policeman and a prison guard were killed in the city, which has been wracked by drug-related violence.
Criminal gangs had threatened to kill at least one police officer every two days until Mr Orduna quit.
Murders are frequent in Ciudad Juarez, which sits on the US border and is a key staging post on the drug route.
Mayor Jose Reyes had insisted earlier the city would not back down to criminal gangs.
But speaking after the two murders, he said Mr Orduna's departure was the only way the authorities could protect policemen.
"These events took place despite the measures that we took to protect the municipal policemen. That is the reason why the decision was taken," Mr Reyes said.
Mr Orduna said he did not want to endanger any more lives after a spate of shootings this week.
"We can't allow men who work defending our citizens to continue to lose their lives," he said. "That is why I am presenting my permanent resignation."
Mr Orduna had only been in the post since May; he took over after his predecessor was forced to flee across the border to Texas following death threats.
His replacement would be found in the next few weeks, the city's authorities said.
The resignation was the latest evidence that drug gangs exercise formidable control over parts of northern Mexico, says the BBC's Stephen Gibbs in Mexico City.
Recent widespread anti-army protests in the region appear to have been largely orchestrated by the cartels.
Nearly a third of the 6,000 people killed in drug-related violence last year died in Ciudad Juarez.
Police were placed on high alert after notices were posted in the city on Wednesday warning Mr Orduna one of his officers would be killed every two days until he resigned.
Two days later, police officer Cesar Ivan Portillo was found dead, and a note taped to his body - and that of the murdered prison guard - said the deaths were a fulfilment of the threat.
The government of Felipe Calderon has vowed to take on the drugs gangs, and some 40,000 troops have been deployed across Mexico since 2006 to battle cartels which make billions of dollars a year exporting cocaine and other drugs to the US.
While this campaign has resulted in record drug seizures, it has also provoked a dramatic escalation in violence, as the gangs fight both one another and the federal forces.