NEW DELHI (Reuters) - India and Pakistan are set to sign an agreement on Indian pilgrims visiting a Sikh shrine in Pakistan, rare cooperation between the nuclear-armed neighbors at a time of tension that has brought exchanges of fire on their disputed border.

The pact will introduce visa-free access from India to the Pakistani town of Kartarpur, home to a temple that marks the site where the founder of Sikhism, Guru Nanak, died.

India’s foreign ministry said in a statement late on Monday an understanding had been reached on most issues and India was prepared to sign the agreement on Wednesday.

Pakistani officials were not immediately available for comment but Pakistan’s Dawn newspaper cited a foreign ministry spokesman as saying agreement had been reached and the two sides would sign the pact soon.

The Sikh minority in India has long sought easier access to the temple in Kartarpur, which is just over the border in Muslim-majority Pakistan.

The collaboration comes at a time of tension between the rivals, with Pakistan particularly aggrieved over recent Indian government measures in its part of the divided Muslim-majority region of Kashmir.

Both countries claim the Himalayan region in full but rule it in part.

India in August revoked special autonomy in Indian-controlled Kashmir, which was accompanied by a crackdown on dissent by India’s security forces there, angering Pakistan.

The dispute over Kashmir has bedevilled relations since their independence in 1947 and sparked two of their three wars.

India said on Sunday two soldiers and a civilian were killed in cross-border shelling in Kashmir while Pakistan said one of its soldiers and three civilians had been killed.

In February, they came close to war following a suicide bombing in Indian Kashmir that killed 40 paramilitary soldiers. In response, India launched an air strike on the Pakistani side and Pakistan shot down an Indian aircraft.

The new crossing will be inaugurated in early November, just before the 550th birthday of Sikhism’s founder on Nov. 12, officials from both sides have said.

The shrine is about 4 km (2-1/2 miles) from the border. The crossing and corridor, including a road, bridge over the Ravi River and immigration office, will replace a drawn-out visa process and circuitous journey through Pakistan.

But there is still disagreement over a $20 fee that Pakistan wants to charge each visitor.

India “has consistently urged Pakistan that in deference to the wishes of the pilgrims, it should not levy such a fee”, India’s foreign ministry said.