After a lengthy and disputed election process, Ashraf Ghani became Afghanistan's president on 29 September 2014. His visit to neighbouring Pakistan on 14-15 November is an important early step in his regional diplomacy. The relationship between the two states had been very difficult during most of the period of his predecessor, Hamid Karzai (2001-14), and improving it is a high priority for the former World Bank official. Indeed, it is always likely that a trip to Islamabad is going to be the most salient in the foreign-policy schedule of any Afghan president.
Pakistan has long been accused of aiding the Afghan Taliban as a means of maintaining its influence in Afghanistan. Its primary strategic motive - which has survived many changes of leadership in Islamabad - is to limit India's role in the region. Indeed, few external analysts appreciate how deeply fear of Indian power runs among the Pakistani elite. In particular, this underlies the army's determination to expand Pakistan’s nuclear force (a project now underway). In political and economic areas too, Pakistan is greatly concerned by the involvement of Indian organisations, both governmental and commercial, in Afghanistan’s development.
For its part the Indian government is principally concerned with Chinese power in the region. New Delhi views Afghanistan as holding a crucial geopolitical position - close to central Asia and the focus of extensive economic interest from a growing China, not least in the minerals sector.
This barely concealed rivalry makes regional diplomacy hard for any Afghan leader, though the technocratic and highly experienced Ghani may appear well equipped for the job. Even these tough regional relationships, however, are less challenging for him than Afghanistan's deep internal-security problems. Above all, the combination of advances by the Taliban and other armed-opposition groups, and the withdrawal by western states of almost all their forces, represent a huge test.
In the wings
Taliban elements have been steadily encroaching on a swathe of territory across much of southern and southeastern Afghanistan. The final phases of the main western evacuation have been relatively quiet, though almost certainly this is because Taliban commanders calculate that there's little point in losing men to western troops when most of the latter are leaving.
The Taliban also benefit via revenues from opium production, which was at an all-time high in late 2013 (according to United Nations sources). The supply will probably hold at current levels, despite the United States and coalition partners having spent $7.5 billion on attempted eradication. Much of the opium is in areas of Taliban influence, thus making appropriate “taxation” of production and transport an easy source of income to finance the movement's activities.
Most current Taliban violence is directed at the Afghan army and police rather than the departing westerners. Indeed, some districts quite close to Kabul are becoming no-go areas for government forces. The New York Times reports:
"The situation in southern Kapisa Province has quietly become one of the greatest challenges of the war for the new government of President Ashraf Ghani. In the absence of international troops or their air support, the Taliban have eclipsed the legitimacy of government forces there and in several other parts of the country, in what many see as a worrying portent for the coming years" (see Azam Ahmed, "Hour’s Drive Outside Kabul, Taliban Reign", New York Times, 23 November 2014).
These problems are compounded by attacks which often kill large numbers of civilians as well as members of the security forces. An example is the bombing of a volleyball tournament on 23 November at Yahya Khel in Paktika province, whose main target was the local police commander, but which also killed at least fifty-seven people and injured many more. Another significant incident was a double bombing near the centre of Kabul, which did not lead to any fatalities but acted as a reminder of the near impunity with which the Taliban and others can penetrate the capital city.
On the ground
The concerns raised by such attacks are increased by doubts about the capacity of the Afghan security forces. In early 2014, as the US withdrawal was being contemplated, it became obvious that the Afghan police and army could not cope. This prompted a substantial rethink, leading to a new bilateral-security agreement between Washington and Kabul. The fact that the lower house of the Afghan parliament approved it by 152-5 votes illustrates the level of concern among Afghanistan’s political elite over the Taliban's capabilities.
Two aspects of the agreement are notable. First, the almost 10,000 US troops that will remain in the country in 2015 will have an expanded role, which will go much further than training missions and occasional involvement in Afghan national army (ANA) operations.
Second, and even more important, the Afghan government’s previous ban on the US's use of special-force “night-raids” is lifted. Hamid Karzai had banned this controversial mode of operation, which was extensively used in Iraq in the mid-2000s. In both countries, night-raids have led to the death and detention of hundreds of suspected insurgents, but also to many civilian deaths. They were widely regarded by affected citizens, perhaps even more acutely in conservative Afghanistan, as quite unacceptable infringements into their homes.
The consequence of Ghani's perhaps reluctant concession on this point is that the US will continue its direct military operations in Afghanistan. The Washington Post says:
“The United States will remain in an armed conflict in Afghanistan - essentially at war - after the end of  year under rules for combat operations the Pentagon requested, and President Obama approved, early this month” (see Karen DeYoung & Missy Ryan, "Afghan mission for U.S. to continue under new authorities", Washington Post, 22 November 2014).
The United States's intention is still to withdraw most of its deployed troops by 2016, though also to leave around 1,000 to protect diplomats and other officials. However, the endemic insecurity in much of Afghanistan makes this frankly implausible. In short, Washington will continue to fight a war in Afghanistan while also pouring troops into Iraq to combat the Islamic State. After eleven years in Iraq and thirteen in Afghanistan, neither war shows any sign of ending.