NEW DELHI -- U.S. President Barack Obama said Tuesday that India will succeed as long as it isn’t “splintered” along religious lines, striking the first discordant note toward the end of an official trip marked by an unprecedented warming of relations between the two countries.

Obama, who is on his second visit to the country as president and was invited as chief guest for India's Republic Day celebrations on Monday, was possibly alluding to the issue of religious conversions that has gained prominence in India in the last few months, since the right-wing Bharatiya Janata Party (BJP) came to power in May last year under the prime ministership of Narendra Modi.

“Our freedom of religion is written into our founding documents, it's part of America’s very First Amendment. Your Article 25 says that all people are equally entitled to freedom of conscience, and the right freely to profess, practice and propagate religion,” Obama said, while addressing a wide cross-section of people in New Delhi, at the end of his three-day visit. “In all countries, upholding this fundamental freedom is the responsibility of government, but it's also the responsibility of every person,” he added.

Modi was denied a visa by the U.S. following race riots in his home state of Gujarat in 2002, but relations between him and the U.S. have undergone a marked change since India's Supreme Court absolved him of involvement in the riots, and he became prime minister following a landslide election victory in May last year.

“Every person has the right to practice their faith, how they choose or to practice no faith at all, and to do so free of persecution, and fear and discrimination,” Obama said.

Obama’s comments are significant coming as they do at the end of a fairly successful visit, during which the two countries announced a move forward on the stalled civil nuclear agreement they had finalized in 2008, and one that also showcased the improved relations between Modi and Obama.

“India will succeed so long as it is not splintered along lines of religious faith,” Obama said.

As International Business Times noted earlier, with the resurgence of the BJP, religion has again assumed significance in the country’s national political discourse. It was Modi’s own party, which, perhaps unwittingly, gave the opposition leverage to bring the Indian parliament to a standstill last year over the conversions issue. Some BJP-affiliated right-wing organizations and some BJP members of parliament had threatened to convert thousands of Muslims and Christians to Hinduism, and also took such a step in early December.

After Modi became prime minister, parts of India’s Uttar Pradesh state and the national capital New Delhi saw several instances of clashes between Hindus and Muslims, though not on the scale witnessed in 2002 in the western state of Gujarat, which Modi, then the chief minister of the state, was accused of having allowed to fester. Although India has a majority Hindu population, its constitution defines it as a secular nation that guarantees equal rights and freedoms to people of all religions.

And while the courts have since cleared Modi of all charges related to the Gujarat riots, he has struggled to address the incidents of 2002. As prime minister, Modi has condemned anti-Muslim remarks made by one of his ministers before parliament, who later apologized.