Philippine leader Benigno Aquino III had called this week's election a referendum on his "straight path" style of reformist governance, but his candidate lost by millions of votes to a shoot-from-the-lip mayor.

And if the vice presidency goes to a son of dictator Ferdinand Marcos, who was ousted 30 years ago by a revolt led by Aquino's mother, that will cloud the political legacy of a family that has been regarded as a bulwark against authoritarianism.

An unofficial tally of Monday's votes shows Sen. Ferdinand "Bongbong" Marcos Jr. closely trailing Aquino-backed Rep. Leni Robredo in a cliffhanger vice presidential race.

Aquino campaigned against tough-talking Mayor Rodrigo Duterte, who has won the presidency by a wide margin based on the unofficial count, and Bongbong Marcos, warning both could be looming dictators. He said they could set back the country's democracy and economic momentum achieved in his six-year term, which ends in June.

Aquino, who was constitutionally barred from seeking a second term, remains popular — indeed, his approval ratings are among the highest for a departing Philippine president in the post-Marcos dictatorship era. But the rise of Duterte, whose tough talk has reinforced perceptions that he could become a strongman, is a reality check on the extent of public dissatisfaction and perceived failures during the reformist Aquino's watch.

The disaffection may have been felt mostly by the growing middle class, said Julio Teehankee, dean of a college dealing with political science and international relations at Manila's De La Salle University.

Under Aquino, the government expanded a program that provides cash to the poorest of the poor in exchange for commitments by parents to ensure their children would attend classes and receive government health care. Big business, meanwhile, benefited from government partnership deals that allowed them to finance major infrastructure projects such as highways and airports for long-term gain.

"The middle-class," Teehankee said, "felt shortchanged."

He said they must endure maddening traffic by land and air, infrastructure problems, taxes that are high relative to the Philippines' neighbors and even what's known as the "bullet drop racket." Many travelers have accused Manila airport personnel of slipping bullets into their luggage, then extorting money from them in exchange for not being criminally prosecuted.

Aquino won a landslide victory in 2010 on a promise to fight corruption and poverty, which afflicts more than a fourth of the more than 100 million Filipinos. But his victory was also seen as a protest vote due to widespread exasperation with the scandals that rocked the presidency of his predecessor, Gloria Macapagal Arroyo, who is currently detained on corruption charges.

The expectations were high and while Aquino moved against corruption — detaining Arroyo and three powerful senators over corruption allegations — and initiated anti-poverty programs, the problems remain daunting.

Critics have also pounded on what they say were his administration's bungling of a number of crises, including a Manila bus hostage crisis that ended with the shooting deaths of eight Chinese tourists from Hong Kong by a disgruntled police officer, and delays in recovery efforts in the aftermath of Typhoon Haiyan in 2013.

Aquino backed Mar Roxas in the presidential election. Roxas served as the president's transport secretary and later interior secretary, leading departments that were regularly criticized.

On the campaign trail, Aquino and Roxas highlighted how the government's anti-corruption drive and other reforms allowed the Philippines to register one of the highest growth rates in Asia from 2010 to last year. Once regarded as the sick man of Asia, they said the country is now considered "Asia's bright star."

Duterte won voters with promises to wipe out crime and corruption within six months, although police officials say that would be almost impossible to accomplish.

If Bongbong Marcos becomes vice president, that might be a more bitter pill for Aquino to swall.

Last February, Aquino evoked horrific memories of Ferdinand Marcos' dictatorship in a speech marking the anniversary of the 1986 "people power" revolt led by his mother, Corazon Aquino. His father, anti-Marcos politician Benigno Aquino Jr., was assassinated in 1983 while under military custody at the Manila airport, which now bears his name.

The younger Aquino railed against Marcos Jr.'s refusal to clearly apologize for the brutal rights violations and plunder that happened during his father's strongman rule.

"This is not about the Aquinos versus the Marcoses," Aquino said at the anniversary. "It is clear to me that this is about right versus wrong."

Frustrated by descriptions of the Marcos era as a golden age, Aquino countered that it was "one of the most painful chapters of our history."

Bonifacio Ilagan, an activist who was detained and tortured during the dictatorship, said Filipinos still cherish the power they demonstrated to remove Marcos in 1986, but were disappointed that expectations of a better life and an easing of the deep inequality that has long plagued Philippine society hasn't been realized three decades after the revolt.

If Marcos Jr. wins, "It will really be a slap, a complete repudiation of the 1986 revolution," Ilagan said.

The successive presidencies after the dictator failed to institutionalize widespread hatred over the abuses and plunder under Marcos by including them and the lessons comprehensively, for example, in school teachings, he said. Criminal cases against the dictator and some of his family members were far from over, he said.

Duterte has declared he would allow Ferdinand Marcos' remains — now displayed in a glass coffin in his northern hometown of Batac — to be buried in the national heroes' cemetery. That is vehemently opposed by nationalists and activists like Ilagan, whose activist sister remains missing since she disappeared in the early 1970s while helping in the anti-Marcos movement.

If the hero's burial for Marcos proceeds, Ilagan said, "that will be a very, very sad day."