BAGHDAD — The US military closed its north Iraq division on Thursday, leaving 18 bases in the country ahead of a year-end pullout, with Baghdad and Washington still at an impasse over a future troop deal.

The closure of US Division-North was the latest in an operation to reduce Washington's troop presence in Iraq, with 39,500 American soldiers currently stationed in the country, all of whom must leave in around two months.

North Iraq includes a tract of disputed territory which local authorities want to incorporate into their three-province autonomous Kurdish region, in the face of strong opposition from the central government in Baghdad.

US forces from January 2010 until summer 2011 operated joint patrols and checkpoints in Nineveh, Kirkuk and Diyala provinces with Iraqi soldiers, police and Kurdish peshmerga fighters in a bid to reduce instability.

General Lloyd Austin, commander of all US forces in Iraq, noted in a speech at a ceremony marking US Division-North's closure that it spanned seven provinces and bordered three countries.

It transferred more than 30 formerly American bases to Iraqi control over the past year, he said.

Washington still has 18 bases in Iraq, according to a US military spokesman. He pointed out the United States retains other bases in northern Iraq after the closure of US Division-North.

All American troops are required to withdraw by the end of the year under the terms of a 2008 bilateral security pact.

Washington and Baghdad are currently at an impasse over negotiations for a future US military presence in Iraq beyond this year.

American officials have conditioned any post-2011 mission on their troops having immunity from prosecution, but Iraqi leaders have said such protection is unnecessary.