The United States must confront Russia for providing weapons to the Taliban for use against US-backed forces in Afghanistan, top US military officials say.

According to the Associated Press news agency, a senior US military official speaking on condition of anonymity said in Kabul on Monday that Russia was giving machineguns and other medium-weight weapons to the group.

The Taliban are using those weapons in Afghanistan's southern provinces of Helmand, Kandahar and Uruzgan, the official said.

OPINION: Afghanistan - A pawn in major power rivalry?

General John Nicholson, the American commander in Afghanistan, would not provide specifics about Russia's role in Afghanistan at a news conference in Kabul alongside Jim Mattis, the US defence secretary.

But Nicolson would "not refute" that Moscow's involvement includes giving weapons to the Taliban.

Asked about Russia's activity in Afghanistan, where it fought a bloody war in the 1980s and withdrew in defeat, Mattis alluded to the US' increasing concerns.

"We'll engage with Russia diplomatically," Mattis said. "But we're going to have to confront Russia where what they're doing is contrary to international law or denying the sovereignty of other countries."

"For example," Mattis said in the Afghan capital, "any weapons being funnelled here from a foreign country would be a violation of international law."

Moscow's position

Russia denies that it provides any such support to the Taliban, which ruled Afghanistan until the US-led invasion in 2001.

Moscow says contact is limited to safeguarding security and getting the group to reconcile with the government - which Washington has failed for years to advance.

Russia has also promoted easing global sanctions on Taliban leaders who prove cooperative.

The Afghanistan war began in October 2001. The US has about 9,800 troops in the country.

They ended their combat mission against the Taliban in 2014, but are increasingly involved in backing up Afghan forces on the battlefield.