By Ahmad Majidyar, Special to CNN

Ahmad Majidyar is a senior research associate at the American Enterprise Institute. The views expressed are his own.

The U.S. mission in Afghanistan has suffered serious setbacks recently. The Taliban’s audacious September 14 attack on a major coalition base in Helmand Province suggested that the security gains in the south remain fragile and reversible, and that the insurgents are trying to make a comeback as foreign troops are withdrawing. Moreover, the alarming rise in insider attacks forced the U.S. and its allies to restrict joint operations with Afghan troops. These developments should alarm Washington as they undermine the security transition to the Afghan lead and the U.S. exit strategy. But on really placating war weary voters, both presidential candidates remain silent on America’s longest war. Mitt Romney made no mention of Afghanistan in his nomination speech, while President Obama only talks about his exit plan.

Yet there is much at stake in Afghanistan. A precipitous U.S. disengagement would allow the Taliban and al-Qaeda to reconstitute in southern and eastern provinces and plot against America and its allies. The United States can succeed in Afghanistan, but it needs to pursue a strategy that focuses more on success than just the endgame and withdrawal. There are five things the next president should do to sustain the gains of the past decade and ensure that Afghanistan will not become a safe haven for global terrorism once again:

Avoid a precipitous withdrawal: The surge of 33,000 troops has now ended, with mixed results. The reinforcements expelled the insurgents from their strongholds in the south; allowed the Kabul government to expand its writ in the strategic provinces of Kandahar and Helmand; and strengthened the Afghan National Security Forces (ANSF). Conversely, the arbitrary withdrawal timelines attached to the surge emboldened the insurgents and gave them an incentive to continue fighting rather than seeking a political settlement. The deadlines also weakened the coalition as other allies followed suit: the Netherlands and Canada have already pulled out troops; France will exit by this year’s end; and Britain is also mulling a quicker withdrawal than previously planned. Moreover, the troop drawdown did not allow the military to replicate the same success in eastern Afghanistan, home to the al-Qaeda-linked Haqqani Network. It is, therefore, imperative that the next administration avoid further reductions to the 68,000 remaining troops precipitously. This will help the coalition to sustain gains in the south and weaken the Haqqanis in the east. In addition, Washington needs to keep a residual force of several thousands in Afghanistan beyond 2014 to continue assisting the ANSF, and to keep a check on al-Qaeda and its affiliates along the Afghan-Pakistani border. A significant U.S. military presence will also send a strong message to friends and enemies in the region that the United States is not abandoning Afghanistan.

Support Afghan security forces beyond 2014: Since the establishment of the NATO Training Mission-Afghanistan (NTMA) in November 2009, the ANSF has developed from 190,000 poorly trained and inadequately equipped personnel into a more effective counterinsurgency force of 350,000 soldiers and policemen. The ANSF is now reportedly leading more than 80 percent of military operations, and will assume security responsibility for 75 percent of the country’s population by year’s end. Despite these achievements, however, the ANSF remains reliant on the coalition for support roles, such as intelligence, surveillance, logistics, and air power. It is essential that the United States and its allies continue support for the ANSF prior to and after 2014, and commit to providing the estimated $6 billion required to sustain the 350,000 ANSF personnel. The White House’s plan to cut the ANSF number to 230,000 due to budgetary restrictions is a mistake. The reduction of 120,000 personnel will not allow the ANSF to fill the vacuum created by the departing foreign troops, and a sizable number of those laid off might join the insurgency or resort to other criminal activity.

Get tough with Pakistan: Ostensibly a U.S. ally, Pakistan has been supporting insurgents fighting in Afghanistan over the past decade. The Haqqani Network and the Mullah Omar-led Quetta Shura Taliban operate with impunity from Pakistan. So far, Washington has done little to dismantle these safe havens or force Pakistan to take action against them. The CIA-led drone strikes have largely targeted al-Qaeda leaders. This needs to change. Washington must present Islamabad with a clear choice: dismantle the Afghan Taliban safe havens in exchange for increased U.S. aid, or face serious consequences. Barring a Pakistani action, the U.S. needs to go after the sanctuaries unilaterally, by increasing drone strikes and conducting Special Forces operations. Blacklisting pro-militant elements within Pakistan’s army and intelligence must also be on the table. These measures would not come without costs, and the Pakistani military might take retaliatory actions, such as closing down NATO’s supply routes. But the cost of inaction will be much higher.

Hold off peace talks with the Taliban: Several years of diplomacy with the Taliban have produced no results. Now that foreign troops are withdrawing, the Taliban has little incentive to accept a political settlement. The insurgents’ policy is to wait out the foreign forces and attempt to topple the Kabul government after 2014. The assassination of Burhanuddin Rabbani, the head of Afghanistan’s High Peace Council, was a clear indication the Taliban had no inclination for peace. Moreover, ethnic minority leaders have begun rearming their militias as they fear President Karzai might reach a backstage deal with the Taliban to remain in power. This does not bode well for Afghanistan’s stability and risks a repeat of the 1990s civil war. It is possible to integrate large numbers of Taliban foot soldiers and field commanders by offering them financial and political incentives. But this is unlikely now as the insurgents have the upper hand in the conflict. The U.S. State Department’s long-overdue designation of the Haqqani Network as a terrorist organization was an encouraging step, but the U.S. and its allies need to take more aggressive diplomatic and military measures to weaken the Taliban ahead of the 2014 withdrawal.

Focus on political transition: The past 34 years of conflict in Afghanistan have shown that military efforts in the absence of a comprehensive political strategy cannot guarantee long-term stability. The pro-communist government in Kabul survived the Mujahedeen’s military offensives for three years after the 1989 Soviet withdrawal. But the growing political divide within the regime coupled with the 1991 suspension of aid from Moscow resulted in the regime’s collapse. At present, too, the state institutions are weak and the political system lacks broad-based legitimacy. Corruption and incompetence in the government are alienating the population and aiding the insurgency. Above all, concurrent with the foreign troops’ withdrawal in 2014, Afghanistan will face a daunting political challenge: the transfer of power from President Karzai to a new administration. Karzai is barred by the constitution to run for a third term. Suggestions that Washington should pick a replacement for Karzai are misguided. It should be left to the Afghans to elect their next leader. But the U.S. and its allies can help to ensure that the election happens in a fair, transparent and secure atmosphere. A repeat of the fraudulent 2009 election could destabilize Afghanistan – and set the stage for another civil war.