IT WAS what many Indonesians had waited months to hear. On March 14th Megawati Sukarnoputri, a former president and head of Indonesia’s main opposition party, the Indonesian Democratic Party of Struggle (PDI-P), at last anointed Jakarta’s popular governor, Joko Widodo, as her candidate for president. This appears to make Mr Joko, known to all as Jokowi, a shoo-in to succeed Susilo Bambang Yudhoyono, who is coming to the end of his second and final term as president.

Most opinion polls put support for the 52-year-old Jokowi at about 40%, twice that of his closest rival, Prabowo Subianto, a former special-forces commander, who is now patron of the Greater Indonesia Movement Party (Gerindra). Barring an unforeseeable disaster, Jokowi seems unbeatable. He may even secure the 50% of votes he needs on July 9th to win the election in the first round, and avoid a run-off in September. After what is widely perceived as years of drift under the likeable but ineffective Mr Yudhoyono, many believe Jokowi is the man to galvanise a sluggish bureaucracy, clean out corruption and boost the economy. That includes the markets: on news of his nomination, Indonesia’s stockmarket and currency both rose.

The only slight hiccup might come on April 9th, when Indonesia holds a parliamentary election. By law, the PDI-P must win at least 25% of the popular vote, or 20% of the seats, to nominate a presidential candidate by itself. Opinion polls, giving the PDI-P the support of about 20% of voters, suggest this could be close-run. The party hopes Jokowi’s star power will push it over the threshold. If not, it will have to team up with at least one other party, to which it could offer the vice-presidency. That is not ideal, but at least Jokowi would have his pick of partners, who would fall over each other to associate themselves with the likely winner.

Perhaps the only surprise is that it took Ms Megawati so long to anoint Jokowi—too long, many said. But she is the proud daughter of Indonesia’s founding president, Sukarno, and at times seems to have regarded the presidency as hers by right. She did indeed hold the office in 2001-04—though she assumed it after the impeachment of her predecessor, and in both 2004 and 2009 was defeated in direct elections by Mr Yudhoyono.

For all the Javanese deference Jokowi has bestowed on her, she may instinctively have regarded him as a usurping upstart, thwarting yet another tilt at the presidency. Or perhaps he was the chosen one all along and delaying the announcement of his candidacy was just tactical. As Jakarta’s governor, he has never had to answer hard questions about foreign policy, the economy or other big national issues.

Jokowi’s style in Jakarta, as it was in his previous job as mayor of the central Javanese city of Solo, has been to take a hands-on approach to fixing the problems that blight ordinary people’s lives: seasonal flooding, poor housing and traffic jams, for example. Above all, Jokowi makes a point of moving among the people and listening to their concerns. Not so much charismatic as practical, his approach is as different as could be from the usual aloofness shown by Indonesian leaders. As president, however, Jokowi could hardly govern Indonesia the same way.

It is clear he owes at least part of his success in Jakarta to his hard-working deputy, Basuki Tjahaja Purnama, known as Ahok. Extraordinarily for such a prominent Indonesian, Ahok is both ethnic Chinese and a Christian. Now, finding the right person to work alongside Jokowi as vice-president will be critical. With the election itself seemingly in the bag, this has become a chief focus of the PDI-P. An obvious choice would be to balance Jokowi’s relative youth and inexperience by picking a seasoned politician, or even a former or active general, from somewhere other than Java, the political and cultural heartland. Ms Megawati, who holds sway over the PDI-P much as Sonia Gandhi does over India’s Congress party, will have a big say in the choice, although she has a mixed record here. She came very close to losing another of its rising stars, Tri Rismaharini, or Risma, the mayor of Surabaya, Indonesia’s second city, by foisting an unwanted deputy on her.

The PDI-P will announce no running mate until after the parliamentary vote. There are now three weeks of raucous campaigning by a dozen parties ahead of that poll. The prospect of a Jokowi presidency looms over the contest. If he wants a taste of how hard it will be to tackle deep-seated problems, he might travel to Sumatra (see article), where the air pollution is worse than ever.