Mexico's Congress has voted to strip Mexico City's mayor of his immunity from prosecution, possibly forcing him out of next year's presidential poll.
Mr Lopez Obrador told a rally he had broken no laws
The left-wing mayor, Andres Manuel Lopez Obrador, has been accused by prosecutors of contempt of court during a land dispute.
Mr Lopez Obrador - favourite for the presidency - says it is a plot to stop him running in the election.
It is up to a judge to decide whether the mayor should face criminal charges.
If he is charged, he is likely to be fired as mayor and may be barred from running in the election.
Mr Lopez Obrador is accused of breaching a court order after allowing the construction of an access road to a city hospital said to go through a disputed plot of expropriated land to continue.
After hours of debate, the lower house of Congress voted 360 to 127, with two abstentions, to strip him of his political immunity.
Arguing his case, Mr Lopez Obrador, a member of the Democratic Revolutionary Party, told Congress: "I am proud to be accused, like those who struggled for justice in the past."
His opponents said he showed contempt for the rule of law and democratic accountability.
Hours earlier, the mayor addressed a rally of some 100,000 people in Mexico City and insisted he had broken no law.
He said that if he was stripped of his immunity and a judge ordered his arrest, he would not seek bail and would go to prison voluntarily.
He also called for peaceful, active civil resistance and for the whole nation to join his alternative project for Mexico.
Since these proceedings against the mayor began, his popularity has soared by as much as 10 percentage points, according to one polling organisation.
His populist left-wing policies have earned him comparisons with Venezuelan President Hugo Chavez.
Mexican President Vicente Fox, who came to power in 2000, is barred by term limits from running in the 2006 election.