A Mexican judge has refused to order an arrest warrant for former President Luis Echeverria on charges that he ordered a massacre of students in 1971.
Echeverria would have been the first president to face criminal charges
Mr Echeverria, 82, who ruled from 1970 to 1976, had faced the prospect of becoming the first Mexican president in modern times to face criminal charges.
But Judge Cesar Flores threw out prosecutors' claims that he and other officials were involved in "genocide".
Dozens of students are thought to have died in the attack in Mexico City.
It was a notorious chapter in the "dirty war" between government forces and leftist guerrillas that took place in the 1960s and 1970s.
Eduardo Maldonado, a spokesman for the office established to look into past crimes, told the Associated Press news agency that prosecutors were likely to appeal against the decision.
The arrest of Mr Echeverria and several other top officials in his government had been sought by Ignacio Carrillo, a prosecutor who spent two years investigating Mexico's dirty war.
It is not known exactly how many people died on 10 June 1971 at the hands of the Halcones (Falcons) - a paramilitary force allegedly created by the ruling Institutional Revolutionary Party (PRI).
But Mr Carillo put the number at "dozens" and deemed the case "genocide" under Mexican law. The judge was given 24 hours to decide whether arrest warrants should be issued.
The reasons for the judge's decision have not yet been released, but defence lawyers had argued that Mexico's statute of limitations meant the time limit to try the case had run out.
The BBC's Claire Marshall, in Mexico City, says the ruling will satisfy the PRI, who had been outraged at Mr Carillo's conclusions and had exerted considerable pressure on President Vicente Fox to drop the investigation.
However, she says, human rights groups are extremely disappointed.
The head of one organisation told the BBC: "This is a very unfortunate decision for the history of Mexico; the judge must have been very frightened."
But Santiago Corcuera, director of human rights studies at Iberoamericana University, told the BBC's Newshour programme that "there may be sufficient grounds for the prosecutor to challenge the judge's ruling".
He says Mexico is signatory to a convention stating that in cases of serious allegations the statute of limitations should not apply.