Editor's note: Peter Bergen is CNN's national security analyst, the author of "Manhunt: The Ten-Year Search for bin Laden -- From 9/11 to Abbottabad" and a director at the New America Foundation.
Washington (CNN) -- The news from Pakistan is generally bad news.
In the past week, which was far from atypical, suicide bombers attacked a court building in the northwestern city of Peshawar taking hostages and killing four people.
In the southern city of Karachi the director of a renowned social program working in the megacity's poorest neighborhoods was shot and killed. And gunmen kidnapped two female Czech tourists in southwestern Pakistan.
But this past week also saw more than a glimmer of good news from Pakistan: Saturday, March 16 marked an extraordinary moment in Pakistani history, as this is the first time a civilian government has served its entire five-year term (from 2008 to 2013). And, for the first time in its history, the Pakistani military appears unwilling to mount a coup against the civilian government. The military has successfully executed three coups and attempted a number of others since Pakistan's independence in 1947.
Today the army understands that the most recent coup by General Pervez Musharraf who took power in 1999 has tarnished its brand.
Musharraf hung on to power for almost a decade and his imposition of emergency rule in 2007 triggered massive street protests and eventually his ouster.
On Saturday, Musharaf announced he is returning to Pakistan from self-imposed exile on March 24 to run in elections that are to be held two months from now.
In a telling sign that Pakistan is moving into something of a new era, Pakistani military officials are not supportive of Musharraf's return and nor is much of the Pakistani public.
On May 11, Pakistanis will go to the polls to elect a new civilian government for a five-year term, and there is now a good prospect for continued, uninterrupted civilian government until at least 2018.
In terms of Pakistan's long-term health and stability, the fact that the country is in an unprecedented era of lengthy civilian rule will help erode the Pakistani military's present position as having uncontested supremacy in all matters that relate to the country's national security, in particular its relations with India and with Afghanistan.
The military has backed insurgent and terrorist groups in India and Afghanistan to maintain its perceived interests in these countries. A more confident civilian Pakistani government will, hopefully, over time be less likely to support these militant groups.
Another great opportunity (and potential peril) will present itself in Afghanistan, when Afghans go to the polls in April 2014 for the third presidential election since the fall of the Taliban.
If that election is perceived as being relatively free and fair this would go a long way to ease tensions in the Afghan body politic, increase Afghanistan's overall security and reassure both Afghan and outside investors that the country has a promising future.
On the other hand, if the 2014 election is seen as unfair, corrupted and is deeply contested, this would likely precipitate a vicious circle of conflict, deteriorating security and capital flight.
The United States, therefore, should do everything it can to provide technical and security assistance to make these elections go as well as possible.
But unlike what happened in the run-up to the 2009 Afghan presidential election, U.S. officials should not get involved in privately backing certain candidates. This private support had the unintended effect of splitting the opposition to Afghan President Hamid Karzai, as key leaders of the anti-Karzai opposition all believed they were "America's candidate." It also deeply alienated Karzai, whose occasional diatribes against the United States are best understood as due to his lingering resentment over this issue.
A key aspect of U.S. and NATO planning for the Afghan presidential elections in April 2014 is that given the fact that there are no discernible front-runners to succeed Karzai, there may be no clear winner who attains more than 50% of the vote, which under Afghan electoral laws would necessitate a runoff election between the two leading candidates.
Security, technical and economic assistance for the Afghan elections should be prepared to extend into summer 2014, because it is not clear as yet when that runoff might be held.
Last year the United States and Afghanistan negotiated a Strategic Partnership Agreement, which ensures America will continue to play a supporting role there until 2024.
The exact details of what that agreement means in practice are still being hammered out (according to U.S. officials, these negotiations may take until November) but they are likely to include not only significant U.S. aid but also many thousands of American soldiers stationed in Afghanistan for years into the future as a guarantor of the country's stability.
The U.S. military has given President Obama a range of options under which as few as 6,000 or as many as 20,000 soldiers would remain in Afghanistan after 2014. Those forces would work as advisers to the Afghan army and mount special operations raids against the Taliban and al Qaeda.
Whatever the final decision is on troop levels, the key point is that the Obama administration and other U.S. officials should emphasize very clearly that the thousands of American soldiers who will remain in Afghanistan are there to support the United States' long-term partnership agreement with Afghanistan -- and that its life extends well beyond 2014.
This is important to emphasize, because Afghans have been understandably confused by some of the different signals the Obama administration has made about its commitment to Afghanistan in the past.
Major confusion arose after President Obama's December 2009 announcement of the "surge" of 30,000 troops to Afghanistan, which was coupled with the announcement that those troops would begin to withdraw beginning in July 2011. In many Afghans' minds, the withdrawal date became more important than the fact that during his first term Obama actually tripled the number of U.S. soldiers in Afghanistan from around 30,000 to a total of 90,000.
When the Obama administration announces the number of soldiers who will remain in Afghanistan post-2014, it should emphasize that the U.S. commitment to Afghanistan is set to last until at least 2024.
This will help in multiple ways: First, this guarantee of a long-term U.S. commitment to Afghanistan will encourage other NATO countries to maintain some of their own troops in Afghanistan to work with the Afghans in areas like training the army and police past the end of the NATO combat mission in December 2014.
Such an announcement will also help reassure Afghans that the United States won't be simply turning off the lights in Afghanistan in December 2014. And it will signal to regional powers like Pakistan and Iran that the United States plans to remain engaged in Afghanistan for many years into the future.
A key issue facing the Afghan government as the United States draws down its forces is how will the Afghan economy fare? Should the economy collapse, the Afghan government's ability to deal with security issues would be substantially eroded. Already, rents in Kabul are tumbling and nongovernmental organizations are laying off staff.
Surprisingly, however, a rigorous and comprehensive World Bank study last year found that Afghanistan will continue to have a healthy growth rate, dropping from its present robust 9% a year rate "to closer to 5% on average until 2018." (The U.S. economy's yearly growth rates over the past four years have been around 2%.)
The economic contraction as the United States draws down is likely to be less severe than might be supposed, partly because the hundreds of billions that the U.S. military has spent in Afghanistan over the past decade is spending that almost entirely benefits the United States.
The World Bank study points out that "military spending by the United States (and other countries) finances the salaries of military personnel, investments in weapons equipment and systems. ... The impact of its withdrawal is therefore likely to be muted."
Another encouraging sign is the investigation of the troubled Kabul Bank, in which some $900 million was lost to fraud, indicating that the culture of impunity for corrupt Afghan officials might be beginning to erode. Earlier this month, 21 officials were found guilty of fraud and two of the former heads of the bank were sentenced to five years in prison. The Afghan Attorney General's office said last week that it would appeal the sentences as being too soft given the scale of the fraud.
A key question is the extent to which the Afghan army and police can operate effectively against the Taliban as the United States withdraws. As yet the Afghan army hasn't shown the ability to conduct large-scale operations without significant American support. In addition, a big issue for the army is the extraordinarily high attrition rate.
Today, a little more then a quarter of the recruits to the army drop out every year. Because of this high dropout rate, NATO is now considering maintaining the Afghan army and police at its present large size of 352,000 men through 2018. (Estimates of the size of the Taliban typically are in the 25,000 range.)
One indicator of the increasingly Afghan-led nature of the fight against the Taliban is the fact that some 300 Afghan soldiers and policemen are now dying every month in the war, while in January three U.S. soldiers were killed, which was the lowest number of any month during the previous four years.
On Afghanistan, Pakistan has some important common goals with the United States, NATO and Afghans themselves. Pakistan does not want to see Afghanistan collapse into a renewed civil war, which would destabilize Pakistan, nor does it want to see the Taliban in charge of the country again.
When the Taliban was in power in Afghanistan the group resisted Pakistani efforts at control, while the Pakistani Taliban have killed many thousands inside Pakistan. These basic shared goals, no civil war and no Taliban control of Afghanistan, can help to create the conditions for a successful post-2014 Afghanistan
Pakistan also wants a Pashtun-led government in Kabul and for the Taliban to have some representation in the south and the east. These are also goals the Afghans can live with.
Karzai is, after all, a Pashtun and given the fact that Pashtuns are the largest ethnic group, the next president of Afghanistan almost certainly will be a Pashtun. And other ethnic minorities can live with a situation in which the Taliban assume a number of provincial and district governorships providing they lay down their arms, join the political process and recognize the Afghan constitution.
According to a senior Afghan government official, numerous discussions between representatives of the Taliban and the Afghan government have taken place over the past years to discuss such a political accommodation, although, so far, not much of anything has come of these talks.
Note: This story is adapted from testimony by Peter Bergen delivered to the House Foreign Affairs Committee on March 19, 2013.
Follow @CNNOpinion on Twitter
Join us at Facebook/CNNOpinion