TWO months ago, Yingluck Shinawatra was a run-of-the-mill businesswoman and a political neophyte. Now she is set to become Thailand's first female prime minister after a stunning victory for her opposition party, the Pheu Thai (PT), in Thailand's election of July 3rd. The election commission announced on Monday that PT won an outright majority, taking 265 of 500 seats in parliament. The ruling Democrat Party took just 159 seats, down from the 170 they enjoy in the current assembly of 480 seats. A handful of smaller parties will share the remainder; some are clambering to join PT in a coalition government. The turnout was nearly 75%, as it was the last time Thais came out to vote, in 2007. The biggest losers are the royalist generals who tried and failed to stop PT in its tracks. The outgoing prime minister, Abhisit Vejjajiva, has announced that he will be stepping down as his party's leader.

Ms Yingluck's transformation into a popular symbol of resistance to the military-backed coalition is quite a feat. An adept campaigner with a keen sense of the common touch, she capitalised on public grumblings over high prices for food and fuel. The Democrat Party trailed in the polls and struggled to convince voters that it could revive a slowing economy. Its main coalition partner, a breakaway faction of PT's predecessor, was mired in allegations of graft. Ultra-conservative yellow shirts peeled away more votes that might have gone to the Democrats with their own “Vote No” campaign.

But Ms Yingluck's victory also has a lot to do with her pedigree as the younger sister of the former prime minister, Thaksin Shinawatra, whose well-oiled political machinery she inherited. Mr Thaksin has called her his “clone”, and everyone knew it, though she insists that voters plumped for her policies and management style. People “didn't select me because my last name is Shinawatra,” she told reporters jammed into the party headquarters, while jubilant fans cheered in the corridors. The former premier was quick to speak out from his self-imposed exile in Dubai, congratulating his sister on her victory and hailing the results as a vote for “change in a peaceful manner”.

Last year all of Thailand seemed on the brink of a violent upheaval, as Mr Thaksin's red-shirted supporters clashed with troops on the streets of Bangkok. By the time the protests were put down, 92 people had been killed. The chaos deepened Thailand's social divisions and hardened the views of the red shirts, whose leaders are now poised to re-enter parliament. Since 2001, Thais have overwhelmingly backed Mr Thaksin and his political parties in four straight elections. His allies have a lock on much of Thailand's populous north and north-east, while the Democrat Party is solid in the south and won most of Bangkok's seats.

Mr Abhisit congratulated Ms Yingluck on her win, but managed a dig at Mr Thaksin in a brief concession speech on the evening of July 3rd, saying that PT's vote was not a “mandate” to grant amnesties to anyone. PT leaders have proposed a political amnesty for Mr Thaksin as path to the sort of reconciliation that might end the years of turmoil that have followed the 2006 coup. But his enemies want him to serve two years in jail for his conviction on abuse of power, a charge that he has dismissed as “Mickey Mouse”. The road ahead is rocky: no wonder that few expect a PT-led government to serve a full, four-year term. Anti-Thaksin protesters have already vowed to resist any attempt to rehabilitate him.

Parliament must convene within 30 days of the election to choose the house speaker, and subsequently to pick the prime minister. He or she is then to select a cabinet, which will be subject to royal appointment. Some insiders have speculated that the party might substitute another candidate for Ms Yingluck, partly as a sop to the army and to palace factions that loathe her brother. But Ms Yingluck's margin of victory and her personal popularity suggest that Thailand will see its first female prime minister.

This is a smack in the face for the army chief, General Prayuth Chan-ocha, who urged voters on June 14th not to elect “the same people” to run the country and lambasted the red shirts as anti-monarchists. It is hard to see how General Prayuth, who commanded troops in the 2006 coup, could get along with a PT-led government that includes abrasive red-shirt leaders such as Nattawut Saikua, who has been charged with terrorism. But Phongthep Thepkanjana, an adviser to the party and a former minister, brushes off the implied threat. General Prayuth “is one in 65m”, he says. The election result “is the resolution of the people.”