Kabul, Afghanistan (CNN) -- France's new president, François Hollande, reaffirmed Friday during a visit to Kabul that France will withdraw 2,000 troops from Afghanistan by the end of 2012.
He spoke after meeting with French troops stationed there and holding talks with the country's president, Hamid Karzai.
Giving a joint news conference with Karzai, Hollande said he had come to tell French troops that "their task has come to an end in Afghanistan."
But he also stressed France's ongoing cooperation with Afghanistan, saying he and Karzai had discussed details of their nations' strategic partnership agreement.
"After 10 years of European military engagement in Afghanistan, now Afghan security forces are taking the responsibility of their own security, and it is time for us to leave," Hollande said.
"But our cooperation and relationship will not end. In January this year, Afghanistan and France signed the strategic partnership agreement, and based on that, we will be increasing our assistance in other fields.
"After the end of this year, our military trainers and mentors will remain to help Afghan security forces. As President Karzai emphasized, we will be focusing on the health sector, education, civil services, agriculture sector, energy and water and many more. We will also be helping in the economic sector."
Karzai praised France as a longstanding ally of his country.
"France has been our friend for a long time now -- we have relations for the past at least 150 years. They helped us before jihad, during jihad and after jihad," he said.
This visit follows Hollande's announcement at the NATO conference in Chicago that French combat troops would withdraw from Afghanistan by the end of the year.
As part of the NATO-led International Security Assistance Force, French trainers will remain in the country longer.
NATO countries are trying to figure out how to meet a 2014 deadline to withdraw from an unpopular war in Afghanistan while shoring up that nation's security forces.
Some nations have already pulled out troops.
The Netherlands, which had nearly 2,000 troops in Afghanistan at the peak of its commitment, became the first NATO ally to withdraw its combat troops two years ago.
Canada, which once headed the ISAF mission, pulled out almost all of its 3,000 soldiers at the end of 2011. Norway also withdrew almost all of its 500 troops during this period.
Hollande, who took office this month, visited French troops at the Nijrab forward operating base in the northeastern province of Kapisa, his office said in a statement.
He "paid tribute to the 83 French soldiers killed carrying out their mission" in Afghanistan, the statement said, as well as the wounded and the families of the victims.
Hollande was accompanied by Foreign Minister Laurent Fabius and Defense Minister Jean-Yves Le Drian.
Hollande's trip to Afghanistan takes place in the same month as President Barack Obama's visit to the country on the anniversary of the killing of terrorist mastermind Osama bin Laden.
CNN's Masoud Popalzai contributed to this report.