US President Donald Trump has mocked Prime Minister Narendra Modi over funding a "library" in war-torn Afghanistan, saying it is of no use there as he criticized India and others for not doing enough for the nation's security.

It was unclear to which "library" project Trump was referring to. His comments were dismissed by India, with sources in New Delhi saying that the government does not send troops abroad except under specific UN mandate.

In his first Cabinet meeting of the year on Wednesday, the US President railed against a litany of perceived injustices, including a lack of international support for Washington in conflicts in the Middle East and Asia, the Independent reported.

Trump asked India, Russia, Pakistan and other neighbouring countries to take responsibility for Afghanistan's security as he defended his move to withdraw troops from that country.

He referred to Prime Minister Modi as an example of how world leaders were talking about their contributions that were nowhere near the billions of dollars the US was spending.

"I could give you an example where, I get along very well with India and Prime Minister Modi, but he's constantly telling me he built a library in Afghanistan. Ok a library. That's like, you know what that is? It's like five hours of what we spend (in Afghanistan)," Trump told his Cabinet members.

"And he (Modi) tells me. He is very smart. We are supposed to say, oh thank you for the library. Don't know who's using it (the library) in Afghanistan. But it's one of those things. I don't like being taken advantage of.

"I say this, India. (I have) great relationship with Prime Minister Modi. He is a great gentleman and a great man and he's done a fantastic job. He has brought the country together," he said.

Though India has not put its boots on Afghan soil, it has played a key role role in the reconstruction efforts of the war-ravaged country, including key infrastructure projects.