Once again President Barack Obama is trying to split the difference with his military commanders. On the positive side of the ledger, he has acceded to U.S. Commander in Afghanistan General Joseph Dunford’s request to keep nearly 10,000 troops in Afghanistan post-2014. That is the bare minimum of what is necessary, but better than other options the president was reported to be considering.

However, by announcing that the troops will only stay two years, Obama seems also to be trying to stake out a political legacy of being the president who ended two wars. That is why he insists that all U.S. troops will be out of Afghanistan by the end of 2016.

It doesn’t make sense to put a timeline on the U.S. troop commitment to the country. The number of troops and the duration of their presence in Afghanistan should be driven by national security imperatives, not the president’s desire for a particular political legacy.

It is no secret that some White House officials, namely Vice President Joe Biden, favor leaving a very minimal presence of around 1,000 troops. But recent credible reporting has made it clear that such a small troop presence would be detrimental to U.S. national security. According to an article that ran earlier this month in the Los Angeles Times, U.S. intelligence officials are drawing down their operations in Afghanistan along with the military draw down. They say that without forward operating bases and logistical support from the U.S. military, the CIA will be unable to sustain its operational tempo in the country. Without a robust intelligence presence in Afghanistan, U.S. counterterrorism efforts will suffer.

If Obama genuinely wants to achieve his stated goal of making sure that “Afghanistan can never again, ever, be used again to launch an attack against our country,” then he should stop issuing arbitrary timelines for the U.S. troop presence there.

In a commentary last month for FOXnews.com, I wrote that the recent elections in Afghanistan should restore some optimism about Afghanistan’s future. The high turnout in the face of Taliban threats and violence should remind Americans why the U.S. went to war in the first place and what’s at stake if we give up on the mission prematurely.

It is vital that the U.S. partner for as long as necessary with the Afghans to prevent a Taliban resurgence, which is fundamental to combating the global terrorist threat. We have seen the impact of the U.S. completely withdrawing from Iraq, where al-Qaeda has made a comeback. While Obama’s pledge to leave nearly 10,000 troops post 2014 is better than leaving fewer, his timeline for their withdrawal is disappointing news for Afghanistan and U.S. counterterrorism efforts in the region.