Afghanistan's parliament has approved agreements with the US and NATO allowing international troops to remain in the country past the end of this year amid a renewed offensive by Taliban fighters.
The move was supported by 152 votes against five objections on Sunday.
Nazifullah Salarzai, a spokesman for Afghanistan's president, said the foreign troops will "train, advise and assist Afghan security forces".
"Afghan forces are responsible for the security and defence of the Afghan people, and in the fight against international terrorism and training of our national security forces we count on the support and assistance of our international partners."
However, US officials said ahead of the vote that President Barack Obama expanded the US role in fighting rebels in the country. Afghan lawmakers made no mention of the new US guidelines that allows American troops to engage Taliban fighters, not just al-Qaeda rebels in Afghanistan.
Obama's decision also means the US can conduct air support when needed. It does not affect the overall number of US troops that will remain in the country.
Earlier this year, Obama ordered the American force presence to be cut to 9,800 by the end of this year, a figure expected to be cut in half by the end of 2015.
Obama wants all US troops to be out of Afghanistan a year later as his presidency draws to a close.