The prime ministers of Pakistan and India have agreed at a rare meeting to cooperate on eliminating terrorism in South Asia, Pakistan's foreign ministry said.

In a sign of easing relations, Indian Prime Minister Narendra Modi also accepted his Pakistani counterpart Nawaz Sharif's invitation to attend a South Asian regional summit to be held in Islamabad next year.

"Both sides condemned terrorism in all its forms and agreed to cooperate with each other to eliminate the menace of terrorism from south Asia," Pakistani Foreign Secretary Aizaz Ahmad Chaudhry said in a statement on Friday.

Sharif and Modi met in the Russian city of Ufa, where they were attending summits of the BRICS trade group and the Shanghai Cooperation Organization. Pakistani television showed the pair shaking hands and smiling.

After around an hour of talks between the two leaders, their governments issued a joint statement including vague commitments on some of the most contentious issues between them, including speeding up efforts to bring those behind the 2008 Mumbai attacks to justice.

While Sharif did attend Modi's inauguration in May last year, relations soon cooled amid flare-ups in violence along the border in Kashmir, the Himalayan region which is claimed by both countries.

Modi's participation at the next summit of the South Asian Association for Regional Cooperation (SAARC) in Islamabad next year will be the first time that Modi travels to Pakistan since coming to power.

Major issues

Al Jazeera’s Kamal Hyder, reporting from Islamabad, said that the development was a positive step, but the issues between the two countries were too complicated to be taken care of through a single meeting.

"The major issues are water distribution, the territorial dispute of Kashmir and the Mumbai massacre, which India blames Pakistan for," he said.

"Pakistan also claims that Indian intelligence is involved on its borders, destabilising the country."

The two countries have fought three wars since the partition of the sub-continent in the wake of independence from Britain in 1947, two of them over Kashmir.

Since 1989 several Kashmiri rebel groups have waged campaigns against the hundreds of thousands of Indian forces deployed in the region, hoping to achieve independence or a merger of the territory with Pakistan.

While the situation has been much calmer since a 2003 truce, India accused Pakistan of killing one of its border guards on Thursday night in firing across the de-facto Kashmir border known as the Line of Control.

Source: Al Jazeera and agencies