Indian Prime Minister Narendra Modi, denied a visa to enter the United States for nearly a decade, on Wednesday addressed a joint meeting of Congress, declaring that India and the United States are “natural allies” and urging the two nations to establish even closer ties.

Dressed in a white knee-length shirt, gray sleeveless tunic and handkerchief in the Indian flag’s colors, the white-haired, bespectacled Modi waved to long introductory applause before addressing Congress in English.

Modi leavened his speech with jokes about bipartisanship, Indian American immigrants and intellectual property, the latter being a thorny issue in talks about the financing of measures to slow climate change.

“I am informed that the working of the U.S. Congress is harmonious. I’m also told that you are well known for your bipartisanship,” he said to laughter. “Well you are not alone,” he added to more laughter. “Time and again I have also witnessed a similar spirit in the Indian Parliament. As you can see we have many shared practices.”

Vice President Joe Biden and House Speaker Paul Ryan of Wis., laugh as Indian Prime Minister Narendra Modi addresses a joint meeting of Congress on Capitol Hill in Washington. (Evan Vucci/AP)

He said that the 3 million Indian Americans “are your strength. They are also the pride of India.” And he mentioned the Indian American children who have won recent Scripps National Spelling Bees. Three of them attended the speech: Jairam Hathwar and Nihar Janga, the 2016 co-champions, and Sriram Hathwar, 2014 co- champion.

Modi noted that the United States is India’s largest trade partner and joked that “it is estimated that more Americans bend for yoga than throw a curveball.” He said that India, which has said that it should not pay for intellectual property for renewable energy technology, had “not yet claimed intellectual property right on yoga.”

Foreign heads of state, including four earlier Indian leaders, have addressed joint meetings of Congress on 118 occasions since 1874, usually on state visits. A handful of leaders have done it more than once. Israeli Prime Minister Benjamin Netanyahu has done it three times, as did British leader Winston Churchill.

It was a particularly unusual address for Modi, who was barred from entering the United States for years because of his failure to stop a series of deadly riots in 2002 by Hindus against minority Muslims in the Indian state of Gujarat, where he was chief minister. Moreover, human rights groups remain concerned about Modi’s treatment of domestic critics and his failure to vigorously protect women’s rights.

But Modi struck a different tone Wednesday, hailing Mahatma Gandhi’s philosophy of nonviolent civil disobedience and its influence on the Rev. Martin Luther King Jr., drawing a standing ovation from members of Congress. Modi said the proximity of the King memorial and the statue of Gandhi on Massachusetts Avenue “mirrors the closeness of ideals and values they believe in.”

He called Congress a “temple of democracy” and said that by inviting him to speak, “you have honored the world’s largest democracy.”

Modi also stressed the importance of the U.S.-India strategic partnership, noting that a “strong India is in America’s strategic interest.” He said India helped secure sea lanes crucial for trade, contributed soldiers to U.N. peacekeeping missions, gave aid to Afghanistan and sought to stem terrorism.

“India exercises more with the United States more than we do with any other partner,” Modi said, adding that the sale of U.S. military goods to India has increased “from almost zero to $10 billion in less than a decade.” Those sales have included mostly big-ticket items such as Chinook and Apache helicopters and P-8 reconnaissance planes.

The Indian leader also thanked Congress for adopting a nuclear cooperation agreement in 2008, opening up the possibility for U.S. companies to help build and supply Indian nuclear power reactors. So far, other legal and contractual issues have prevented any deals, though India’s state-owned nuclear power company and Toshiba subsidiary Westinghouse Electric said they would start preparing a construction site and would aim to reach a deal by June 2017.

The nuclear cooperation agreement “changed the very colors of leaves of our relationship,” Modi said.

Obama has reached out to Modi in the two years since the Indian leader became prime minister. His administration has been eager to counter China’s expansion. On Tuesday, a joint statement by the two leaders said that the United States would “work toward facilitating” the sharing of some of the most sensitive U.S. military technology with India, as the United States now does with only its closest allies. The two also said India would receive technologies that could be used for military purposes as well as nonmilitary. There have been some restrictions ever since India diverted peaceful nuclear technology to its nuclear weapons efforts.

In addition to seeking to establish India as a strategic bulwark, Obama has sought to persuade Modi to take swift action to slow climate change and to back the accord reached at the international climate summit in Paris in December. With the world’s fastest economic growth rate, a boom in fossil fuel energy output could trigger vast new greenhouse emissions.

Modi said that his economic “to-do list is long and ambitious,” including “a roof over each head with electricity for all households.” He said India would build “smart cities” with broadband to connect even remote villages to the “digital world,” and expand the country’s road and port infrastructure, much of it by 2022.

“These are not just aspirations but goals to be reached in a finite time frame,” he said, while pledging to do so “with a light carbon footprint and a great emphasis on renewables.”

That was a reference to Obama agreeing that India should become a permanent member of a reformed U.N. Security Council. That detail was in the joint statement distributed Tuesday. Modi mentioned it obliquely, though. Modi did not read one line that was in his prepared remarks that were distributed just before he started speaking.

“The effectiveness of our cooperation would increase if international institutions frame with the mind-set of the 20th century were to reflect the realities of today,” Modi said.

He addressed a full chamber, though several seats in the side sections of the House floor appeared to be filled by staffers and Indian officials. The Obama administration members who sat in the front area included Interior Secretary Sally Jewell, Department of Homeland Security Secretary Jeh Johnson, Office of Management and Budget director Shaun Donovan, Environmental Protection Agency administrator Gina McCarthy and U.S. Trade Representative Michael Froman. .

Jeffrey P. Bezos, owner of The Washington Post and chief executive of Amazon, also attended. On Tuesday, Bezos pledged that Amazon would invest an additional $3 billion in India, boosting its investment in the country to more than $5 billion.