(CNN) -- Mexican President Felipe Calderon's ruling party paid the price for a weak economy in midterm elections as the opposition Revolutionary Institutional Party rolled to victories in the lower legislative house as well as state and local posts.



Mexican President Felipe Calderon wasn't on Sunday's ballot and has three years left in his six-year term.



With more than 99 percent of the votes counted, the PRI had 36.7 percent to 28 percent for Calderon's National Action Party (PAN), the state-run Notimex news agency reported Monday.



The leftist Party of the Democratic Revolution (PRD), which nearly won the 2006 presidential election, came in a distant third with 12.2 percent of the vote.



In response to the defeat, PAN president German Martinez resigned from the top party post Monday.



On the ballot were seats for 500 federal legislators, six governors and about 500 mayors and local legislators in 11 states. Though Calderon has three years left in his six-year term and was not on the ballot, analysts said Monday he was held responsible for Mexico's problems amid the global economic downturn.



"He got a beating because of the economy," said Ana Maria Salazar, a television and radio political commentator in Mexico City.



"The government in power pays for it," said Peter Hakim, president of the Washington-based Inter-American Dialogue.



Besides the economy, Calderon has had to face the consequences of a drug war he launched that has left more than 10,000 people dead since he came to office in December 2006.



He also had to deal with the H1N1 flu pandemic that first became known in Mexico this year.



The PAN has the most seats in the Senate and the Chamber of Deputies, the lower house of Mexico's Congress, but it does not have a majority in either. The party lost its lead in the lower house, as the PRI will hold more seats when the new delegates are seated in December. No seats were at stake in the Senate, which elects its members every six years.



Calderon acknowledged the setback in a late-night address to the nation Sunday.



"The federal government recognizes the new composition of the Chamber of Deputies since it is a sovereign decision of the citizens. I congratulate who they have chosen," Calderon said, adding he will work with the new representatives.



He will have no choice but to work with the resurgent PRI, analysts said. But since the PAN did not have control of either house of Congress, Calderon has been compromising and making deals with the PRI and other parties since coming to power.



"I don't think the job is much more difficult than it was at the outset," Hakim said. "It's all a matter of degrees. Yeah, it will make it a little more difficult. But he has had to work through negotiation anyway."



Still, analysts said, the PRI now wields considerable more power.



"They're in a position to run Congress," said Andrew Selee, director of the Woodrow Wilson Center's Mexico Institute.



By forming temporary coalitions with the Green Party and other minor parties, the PRI can block presidential vetoes, Salazar said.



"They pretty much have control over the purse," she said.



Much more is at stake for the PRI though. After having held the presidency from 1929 to 2000 and then losing it to the PAN in the last two elections, the party is looking for a path back to power. Sunday's results were particularly significant because the PRI finished third in the 2006 presidential election.



"The presidential campaign has started as of today, Monday," Salazar said.



Also significant was the PRD's apparent collapse as a major party, considering it came within 1 percent of winning the presidency in 2006.



That race was so close that the results were not verified until a controversial decision two months later. Losing candidate Andres Manuel Lopez Obrador refused to accept the results and announced himself the winner. Fistfights broke out in the Chamber of Deputies.



The PRI drew away votes
What did Calderon's party lose? What did Martinez do? What is the name of the president of the political party PAN? What percentage of approval has the PRI political party? Who was held responsible for economic downtown? Who resigned in aftermath? PRI has  what percent of vote ? who is the president of pan? who lost the lead? what are the percentages?
midterm resigned from the top party German Martinez 36.7 percent Calderon PAN president German Martinez 36.7 German Martinez The PAN PRI had 36.7 percent to 28 percent for Calderon's National Action Party
question: What did Calderon's party lose?, answer: midterm | question: What did Martinez do?, answer: resigned from the top party | question: What is the name of the president of the political party PAN?, answer: German Martinez | question: What percentage of approval has the PRI political party?, answer: 36.7 percent | question: Who was held responsible for economic downtown?, answer: Calderon | question: Who resigned in aftermath?, answer: PAN president German Martinez | question: PRI has  what percent of vote ?, answer: 36.7 | question: who is the president of pan?, answer: German Martinez | question: who lost the lead?, answer: The PAN | question: what are the percentages?, answer: PRI had 36.7 percent to 28 percent for Calderon's National Action Party