THE political party which has ruled Mexico for 68 years has been stunned by the extent of its defeat in Sunday's elections.
But the country has remained calm after a night of celebrations in the capital by the supporters of Mr Cuautehemoc Cardenas who routed his opponents to become the first elected mayor.
The Institutional Revolutionary Party (PRI) has lost its majority in the lower house of Congress, the political control of Mexico City and two of the six state governorships also decided on Sunday.
But President Ernesto Zedillo who introduced the electoral reforms which have led to the losses for his own party, welcomed the results as a "historic step" towards Mexico becoming a normal democracy.
The elections monitored by thousands of observers from Mexico and abroad as the first under the new reforms were orderly, except in parts of the troubled southern state of Chiapas.
There, about 600 polling stations out of 3,520 could not open because of attacks by the Zapatista rebels. The elections in one of the federal districts may now have to be annulled but this will not affect the national results.
The financial markets also reacted calmly to the setback for the PRI - which they had already discounted. The stock market has been rising steadily and there are signs that the economy is on the way to full recovery from the peso devaluation crisis of 1994-95.
The economic slump which followed that crisis is seen as contributing to what the press is calling "the debacle" of the ruling party. The election was also the voters' first opportunity to express their anger at the revelations of corruption under the regime of the previous PRI president, Mr Carlos Salinas, who is in exile in Ireland, while his brother, Raul, is in jail on charges of fraud and conspiracy to murder.
The victory of Mr Cardenas in the capital was not unexpected as he had been leading strongly in recent opinion polls. But his centre-left Democratic Republican Party (PRD) also swept the board in the election for the city council and polled strongly in the federal parliamentary election, helping to deprive the PRI of its absolute majority, according to the latest incomplete results.
The elections brought mixed fortunes for the conservative National Action Party (PAN), which did badly in the mayoral election after being favourite several months ago. But the PAN won two of the provincial governorships from the PRI, including the influential Nueva Leon state, and now controls six of the 31 states. The party also gained seats in the lower house, where it will be the second biggest after the PRI.
While Mr Cardenas stole the limelight with his crushing win in the capital, the PRI's loss of control over the lower house of the Congress is more significant politically. Until now the president and the government were assured of a rubber-stamp majority to put through the budget and other legislation.
Now President Zedillo will have to negotiate with the PAN and the PRD to get parliamentary approval for the 1998 budget. It will also be more difficult for the government to stifle parliamentary inquiries into corruption under the PRI, which will have to come to terms with its diminished role after running the country since 1929.
President Zedillo will have to work out a modus vivendi with Mr Cardenas when he takes office as the first elected mayor of the capital, with its 8.5 million inhabitants, next December.
Most observers expect Mr Cardenas to use his high-profile post to begin running for president in 2000; but he will also have to show that he can solve some of the overcrowded city's more pressing problems
With about 20 million people packed into the greater metropolitan area, there are constant problems of crime, pollution and water, shortages.