For the first time in Pakistan's nearly 66-year history, a democratically elected government has completed a full, five-year term.

In a country where the military has ruled directly for half of its existence, and often intervened from backstage, Saturday’s formal completion of the government’s term marked the only occasion one civilian administration stood aside to transfer power to a successor.

The landmark moment was recognised by Prime Minister Raja Pervez Ashraf, who on Saturday night spoke to the nation in a televised address. “Despite all the odds, completion of the term is an extraordinary and historic achievement,” he said.

Download the new Independent Premium app Sharing the full story, not just the headlines

In the days ahead, Mr Ashraf and leaders of the ruling Pakistan Peoples Party will sit down with politicians from the main opposition party to try and agree upon a caretaker premier, who will oversee an election likely to take place in early May.

But before the campaigning started, Saturday marked a rare opportunity for Pakistan to bask in the glow of its hard-earned democratic achievement, one that few people back in February 2008, when the country held an election, believed likely.

Many hope this point could mark an end to the days of military dictatorships. “The question of who remains at the helm of power does not remain a question mark but has become an answered question,” outgoing foreign minister Hina Rabbani Khar, told The Independent on Sunday, on her last day in office.

“It should be nothing for a country to be proud of that in 66 years, there’s a peaceful democratic transition from one civilian government to another,” Ms Khar said. “But because it is the first time, it shows how much there is to be proud of.”

The credit for the achievement will be shared, in varying degrees, by Pakistan’s different power centres. The government has won praise for managing to steer through a sometimes-hazardous course, holding together a weak, unpopular and sometimes fractious ruling coalition.

The opposition, too, is deserving of recognition. In the past, politicians never let an opportunity slip to see their opponents fall, no matter whom the ultimate beneficiary may be. This included enlisting the support of the powerful army.

But former prime minister Nawaz Sharif, the main opposition leader, has been seen to show admirable restraint. When his Pakistan Muslim League-N provincial government in Punjab was toppled, Mr Sharif led marches in protest and in support of the deposed judiciary. When his demands were met, he called an end to the 2009 so-called long march, against the advice of hawks within his party.

Daily coronavirus briefing No hype, just the advice and analysis you need Enter your email address Continue Continue Please enter an email address Email address is invalid Fill out this field Email address is invalid Email already exists. Log in to update your newsletter preferences Register with your social account or click here to log in I would like to receive morning headlines Monday - Friday plus breaking news alerts by email Update newsletter preferences

In the past, he may have been tempted to proceed to Islamabad and dislodge his arch-rival, President Asif Ali Zardari. There is no love lost between the two squabbling politicians, but they managed to work together to pass three constitutional amendments together in a fiercely divided parliament.

“Politicians seemed to have learned, if not completely, than partly, that when they fight and cross a certain line, then they all lose. This time they have stopped one step short of that line,” said Dr Hasan Askari Rizvi, a political analyst.

Yet the achievement was not reached without dark, difficult episodes.

Indeed, there were several moments when some feared a “soft-coup” unfolding and the government being sent home, to be replaced by a cabinet of technocrats handpicked by the military and the judiciary. Last June, former prime minister Yousaf Raza Gilani was sacked by the Supreme Court for refusing to write a letter to Swiss authorities, urging them to reopen old corruption cases against his boss, Mr Zardari.

The court looked poised to sack his successor two months ago, when it issued an arrest warrant for Mr Ashraf. In the end, the court eased off, allowing the government to complete its term without having to choose a third prime minister. The chief justice, Iftikhar Chaudhry, has insisted that elections take place on time.

Pakistan’s most powerful man, Gen. Ashfaq Parvez Kayani, notably resisted treading the path of his predecessor, Gen. Pervez Musharraf, and promoting himself President. While he asked for, and received, a three-year extension as army chief, he has resisted calls for the military to upend the civilian government.

The military has carved out a role for itself where it calls the shots on foreign policy, national security and even elements of the economy while the civilian government runs day-to-day affairs. Given the grim circumstances Pakistan finds itself in, with unrelenting terrorist attacks, enduring power shortages, a sagging economy, and rising public discontent, the generals would not like to be in direct control.

“This government survived because the army took a clear decision that it will stay away from politics. That decision was not altruistic but was based on rational calculation,” said Ejaz Haider, an author and analyst. “The period of Gen Musharraf, especially after 2007, had done much harm to the army’s image. As a discerning commander, Gen Kayani realised that the irregular war the army was fighting required a civilian imprimatur and a public buy-in.”

There have been times, however, when the military has intervened to assert its clout. The 2009 march led by Mr Sharif came to an end when Gen Kayani brokered an agreement. When the civilian government wanted to place the head of the ISI under its own control, the move backfired within 24 hours. The ISI also pushed back against the government’s request that its head travel to Delhi in the aftermath of the 2008 Mumbai attacks.

The army has also publicly spoken out against the Kerry-Lugar Bill, a piece of US legislation that proposed a tripling of non-military aid, on the grounds that its conditions were humiliating. The army also traded blows with Mr Gilani when he warned that there should not be “a state within a state,” a suggestion that the army still held ultimate sway backstage.

The past five years may end up mattering more in the long term. At the moment, many of Pakistan’s voters appear disenchanted with what democratic rule has yielded, with rising anger at inflation, power cuts, poor law and order, and tales of alleged corruption.

“The main problems facing the new government will be the same as the problems facing the current one,” said Mr Askari Rizvi, the analyst. “One will be dealing with the economy and generating energy, and the second will be dealing with extremism and terrorism.”