WASHINGTON (Reuters) - Indian Prime Minister Narendra Modi called for a closer security relationship between his country and the United States on Wednesday, in an address to the U.S. Congress stressing the importance of warming ties between the two countries.

He dedicated much of the speech to the importance of fighting terrorism, thanking Congress for U.S. support after a Pakistan-based military group’s rampage in Mumbai killed 166 people in 2008.

“The fight against terrorism has to be fought at many levels. And the traditional tools of military, intelligence or diplomacy alone would not be able to win this fight,” Modi told a rare joint meeting of the Senate and House of Representatives.

“We have both lost civilians and soldiers in combating it. The need of the hour is for us to deepen our security cooperation,” Modi said.

He leavened the speech to lawmakers, the first such address by an international leader since Pope Francis’ in September, with jokes about Congress’ bitter partisan divide and yoga. But Modi used it to make serious points about India’s neighbor and arch-rival Pakistan and regional concerns about Chinese expansionism.

“I commend the members of the U.S. Congress for sending a clear message to those who preach and practice terrorism for political gains,” he said, not mentioning either country by name.

Modi is on the U.S. leg of an international tour. On Tuesday, he met with President Barack Obama at the White House, where the two leaders said India agreed to work toward joining the Paris Agreement on climate change this year and discussed security and cyber security issues.

Slideshow ( 12 images )

The visit, two years after Modi became prime minister, capped an improving relationship between New Delhi and the United States. Before he was elected, Modi was barred from even entering the country because of concerns about his handling of 2002 riots that killed at least 1,000 people, mostly Muslims.

PERSONAL TIES TO OBAMA

Today, he is one of the international leaders most popular in Washington, where Modi’s government is seen as a counterbalance to China. He and Obama have a warm personal relationship.

“We are now standing shoulder to shoulder in ways that no one could have imagined a generation ago,” Representative Eliot Engel, the top Democrat on the House Foreign Affairs committee, said at a reception for Modi after the address.

In a 45-minute speech interrupted by cheers and at least eight standing ovations, the 65-year-old Indian leader said deeper U.S.-Indian security cooperation should isolate anyone who harbors, supports or sponsors terrorists.

Although he did not mention Pakistan, that line was greeted with applause from the lawmakers, many of whom are increasingly frustrated with what they see as Islamabad’s failure to crack down on militants behind attacks on American troops in Afghanistan.

Slideshow ( 12 images )

Modi also stressed that India is committed to helping rebuild a peaceful and stable Afghanistan.

Amid heightened tensions over China’s assertive pursuit of territory in the South China Sea, Modi said a stronger U.S.-India partnership could boost peace and prosperity “from Asia to Africa and from the Indian Ocean to the Pacific.” He did not mention China.

“It can also help ensure security of the sea lanes and commerce and freedom of navigation on seas,” Modi added.

Democrats leaped to their feet when Modi referred to the recent climate change summit. But Republicans in the House chamber remained seated, reflecting the U.S. political divide over the issue.

House Speaker Paul Ryan greeted Modi at his office before his speech. After the Indian leader’s remarks, he attended lunch with congressional leaders and a reception with members of the House Foreign Affairs and Senate Foreign Relations committees.