(Updates with background, quotes)
By Sheree Sardar and Mehreen Zahra-Malik
ISLAMABAD May 24 (Reuters) - Pakistan has accepted an invitation to Prime Minister Nawaz Sharif to attend the inauguration of Indian Prime Minister-designate Narendra Modi, an official said on Saturday.
The Pakistani premier's attendance will be a first in the history of the nuclear-armed rivals, which have fought three wars since independence in 1947.
"There will be a bilateral meeting on the sidelines between Prime Minister Nawaz Sharif and Mr. Modi," Mohyuddin Wani, the joint secretary of the Prime Minister's office, told Reuters. "Mr. Sharif will also be calling on the Indian president."
Ties have been particularly tense since the 2008 attacks on Mumbai blamed by India on Pakistan-based militants.
Sharif came to power last year promising to rebuild relations with India but has been under pressure to toughen his stance from hardliners at home, particularly within the army.
The top source of friction is his aim to boost trade with India. Many army officers say India must vacate its part of the disputed territory of Kashmir before ties can improve.
In India too, former Prime Minister Manmohan Singh's efforts to rebuild economic and diplomatic ties fell apart when deadly skirmishes broke out along the border in Kashmir last year.
Modi's Bharatiya Janata Party has long advocated a tough stance on Pakistan, a view reflected in his election campaign that produced a parliamentary majority. The new Indian leader is seen as a hardliner on issues of national security.
But officials in Pakistan are also hopeful that Modi will seize an opportunity to rebuild ties, because he is much less vulnerable to the charges of weakness that plagued Singh.
OPENING MARKETS, NORMALISING TRADE
Modi's ambitious economic agenda will require India to open markets and normalise trade with neighbours. He may find Sharif, a proponent of free markets with a history of conciliatory gestures towards New Delhi, a worthy ally.
The relationship improved the last time the BJP took power, in 1998, under Prime Minister Atal Bihari Vajpayee, who rode a bus to Lahore during Sharif's previous stint in power to sign a peace accord.
Three months later, the Pakistan army torpedoed Sharif's attempts to improve ties by secretly sending soldiers disguised as militants to capture Indian outposts in the heights of Kargil, in the north of Indian Kashmir.
Lasting India-Pakistan peace would help smooth a perilous transition in Afghanistan as most NATO combat forces prepare to leave by the end of this year.
"We still have to gauge what Modi's government's stand is on the many issues that remain unresolved between Pakistan and India," an information ministry official said, requesting anonymity as he was not authorised to comment on the issue.
"The inaugural speech will hopefully set the tone of relations and we can take it from there."
Former military ruler General Pervez Musharraf was the last Pakistani head of state to visit India in 2005.
Last year, former Indian Prime Minister Manmohan Singh declined Sharif's invitation to attend his oath taking ceremony after Pakistan's general election. (Writing by Katharine Houreld; Editing by Kim Coghill and Ron Popeski)