US President Barack Obama’s second visit to India may have been marked by affectionate talk about shared values between the two countries and his ‘bromance’ with Prime Minister Narendra Modi.

However, as Mr Obama left Delhi, he raised the twin issues that have embarrassed and hurt international perceptions of India in recent times, that of women’s rights and religious tolerance.

In his parting comments before an audience of school students, Mr Obama said that it was vital to educate and empower girls as much as boys if countries wanted to develop effectively.

“We know from experience that nations are more successful when their women are successful. This is one of the most direct measures of whether a nation is going to develop effectively – how it treats its women. When a girl goes to school, it doesn’t just open up her young mind, it benefits all of us,” he said.

“Maybe some day she’ll start her own business, or invent a new technology or cure a disease. And when women are able to work, families are healthier, communities are wealthier, and entire countries are more prosperous.”

The issue of the poor treatment of women in India has come into sharp focus ever since the horrific gang rape and murder of a young student on a Delhi bus in December 2012 – an event that sparked protests among India’s long-indifferent masses and shocked the international community.

Mr Obama was speaking days after Prime Minister Modi launched a campaign to tackle the dwindling number of girls in India – the result of decades of deliberate abortions of female fetuses due to a cultural preference for sons.

India’s 2011 census showed that while the overall female-to-male ratio had risen marginally since the last census a decade earlier, fewer girls were born than boys.

Modi’s campaign “Beti Bachao Beti Padhao” (Save the Daughter, Teach the Daughter) is aimed at improving the sex ratio and gender equality in general through access to education.

Obama said he was impressed by the participation of so many women during his three-day visit, including those in the armed forces at Monday’s Republic Day parade.

“If nations really want to succeed in today’s global economy, they can’t simply ignore the talents of half their people. And as husbands and fathers and brothers, we have to step up because every girl’s life matters, every daughter deserves the same chance as our sons, every woman should be able to go about her day, to walk the streets, or ride the bus and be safe and be treated with respect and dignity. She deserves that”, he added to rapturous applause.

The US leader also weighed in on another sensitive issue in India – that of freedom o religion.

Mr Obama warned India not to stray from its constitutional commitment to allow people to freely “profess, practice and propagate” religion.

“India will succeed so long as it is not splintered along the lines of religious faith, as long as it is not splintered along any lines, and it is unified as one nation”.

Obama’s speech, after three days in New Delhi aimed at cementing a strategic partnership, was widely interpreted as a message to Prime Minister Narendra Modi and his Hindu nationalist Bharatiya Janata Party (BJP), whose rise to power emboldened activists to declare India a nation of Hindus.

He made no direct reference to Mr Modi, who was banned from U.S. travel for nearly a decade until last year after deadly Hindu-Muslim violence in a state he ruled in 2002.

Lately, religious conversion has again become a divisive political issue, after hardliners with links to the BJP claimed Hinduism was under threat and started a campaign to convince Christians and Muslims to change their faith.

About a fifth of India’s 1.27 billion people identify themselves as belonging to faiths other than Hinduism.

Modi has warned lawmakers from his own party to stop promoting controversial issues such as religious conversions and to focus on economic reforms.