In the runup to the Turkish election, speculation in English-speaking publications centered on whether President Recep Tayyip Erdogan's AKP party would get a large enough majority in the parliament to amend the constitution without a popular referendum.
The AKP, usually described as mildly Islamist, has been in power since 2002. In some respects it has compiled a record that compares favorably with those of the secularist party coalitions that came before. The AKP liberalized the economy, to the point that its vigorous economic growth made Turkey's bid for membership in the European Union seem plausible. Erdogan also pursued rapprochement with the nation's Kurdish minority.
For years, many Westerners were disappointed that Turkey's brand of secularism, instituted by the republic's founder Kemal Ataturk in the 1920s and 1930s, did not inspire others in the Muslim world. Erdogan for a moment seemed to provide another alternative, potentially more attractive to Muslims today, of an Islamic regime with which the West could live comfortably.
But since 2007, Erdogan has pursued an ominous course. His regime prosecuted political enemies, jailed journalists (at one point more were imprisoned than in any other country) and denounced Jews and Israel. Turkey, a NATO member with one of the alliance's largest militaries, increasingly pursued Middle East policies out of line with the United States.
Moving from the office of prime minister to the presidency in 2011, Erdogan made no secret that he wanted to expand the powers of that office in a way that reminded many of Russia's Vladimir Putin.
AKP won a parliamentary majority in 2002 with 34 percent of the popular vote, because only two other parties met the 10 percent threshold for legislative seats. In 2007, its popular vote share was 47 percent and its majority increased. But this year that fell to 41 percent, and a third opposition party, the Kurdish-based HDP, qualified for seats with 13 percent.
Turkey may be in for some messy politics. If the AKP minority can't form a government, there could be another election soon. The move to authoritarian government seems to be stymied, but the risk of government with no authority remains.
Nevertheless, it's clear that some substantial number of Turkish voters were moved to oppose what seemed to be Erdogan's increasingly dictatorial tendencies. That's a hopeful sign when many believe electoral democracy is in worldwide decline.
Something roughly similar seemed to happen the same Sunday in Mexico's congressional and state elections. For 70 years, from 1929 to the 1990s, Mexico had one-party government. PRI, the Party of the Institutional Revolution, won all presidential and almost all local elections.
That changed when the center-right PAN party started winning governorships in the 1990s and won the presidency in 2000 and 2006. And the current PRI president, Enrique Pena Nieto, has proven to be an effective reformer in many ways.
But corruption, police killings and narcotrafficking continues, and Mexican voters have responded with votes for various alternatives. An independent candidate was overwhelmingly elected governor of Nuevo Leon, site of Mexico's third largest city, Monterrey. In Guadalajara, an independent leftist was elected mayor. A soccer star was elected mayor of Cuernavaca as a minor party candidate.
In Mexico City, former mayor Andres Manuel Lopez Obrador's new Morena Party won council seats -- a result that owes something to his leftist politics but also to his competence as mayor.
Overall, there was a major swing away from the three major parties -- PRI, PAN and the leftist PRD. In 2009, the last off-year elections, those parties won a combined 77 percent of total votes for the lower house of Congress. This year they were down to 61 percent.
As in Turkey, the resulting politics could be messy. There is no runoff in the elections to Mexico's powerful presidency, so the proliferation of parties increases the possibility of a 2018 victory for a candidate profoundly unacceptable to most voters. That's what resulted in the suspension of electoral democracy for 15 years in Chile in the 1970s and 1980s.
So there are risks as well as rewards in these results. But it's heartening that at a time when many analysts see authoritarianism rising and democracy ebbing, voters in Turkey and Mexico are resisting movement in that direction.