KABUL, Afghanistan (AP) — U.S. Defense Secretary Leon Panetta has arrived in Afghanistan on an unannounced visit to consult with top commanders and President Hamid Karzai.

The visit Wednesday comes at a difficult juncture in the Western coalition's efforts to shift more security responsibilities to Afghan forces so the combat mission can end in 2014.

While security has generally improved lately, the Afghan government's ability to effectively govern and to root out corruption is in great doubt. Peace talks with the Taliban are on a back burner.

Panetta said earlier Wednesday in Kuwait, where he gave a pep talk to U.S. troops, that President Barack Obama will decide within a few weeks how many U.S. troops to keep in Afghanistan beyond 2014.