Pakistan and Afghanistan have a long and complex relationship. The Durand Line border was established in 1893 but disputed by Afghanistan. Relations were initially strained but improved after visits by leaders in the 1950s. The 1965 and 1971 India-Pakistan wars saw Afghanistan support or remain neutral towards Pakistan. The Soviet invasion of 1979 threatened Pakistan's security and it supported the US-backed mujahideen. After 9/11, Pakistan had to choose between supporting the US war on terror or facing retaliation, and opted to back the US-led operation in Afghanistan. Relations have continued with high-level visits and agreements but tensions remain due to militant activity and Indian influence in Afghanistan.