An agreement on the transfer of U.S.-managed detention centres to Afghan authorities is likely soon, the Afghan presidential spokesman said Tuesday, improving the prospects of a strategic partnership deal allowing for long-term U.S. involvement in the country.

Both sides are studying a memorandum of understanding now. I am optimistic we will reach an agreement in the next three days, the spokesman, Aimal Faizi, told Reuters. U.S. embassy officials were not immediately available for comment.

The Strategic Partnership Agreement, which Washington and Kabul have been discussing for over a year, will be the framework for U.S. involvement in Afghanistan beyond 2014, when the last foreign combat troops are due to leave Afghanistan.

Afghanistan wants the United States and NATO to agree to stop carrying out night raids on Afghan homes as a precondition for signing an agreement with Washington and a timeline to assume control over detention centres.

In a meeting Monday between Afghan President Hamid Karzai, U.S. ambassador Ryan Crocker and Gen. John Allen, the NATO commander in Afghanistan, the American side proposed a six-month timeline for the transfer.

Karzai was reported to have set a deadline of March 9 for the United States to hand over the detention facilities.

An Afghan official said that under one possible scenario, a transfer of prisons could start within the next few days and it may be completed within six months.

There are improvements, Karzai told reporters Tuesday of negotiations on a partnership.

The Obama administration has been hoping it can conclude an agreement before a meeting of NATO leaders in Chicago in May.

While the document would not nail down details, it is expected to contain an agreement in principle to some sort of U.S. military presence in Afghanistan beyond the end of 2014, when most NATO combat troops are expected to be gone.

A failure to broker a deal might strain U.S.-Afghan relations, and increase the chances of prolonged instability in Afghanistan.

The latest round of talks have been complicated by tensions over the burning of copies of the Muslim holy book at a NATO base, which triggered violent protests and prompted some Afghan security forces to turn their weapons on American soldiers.

While the rules covering night raids and air strikes have been tightened, they continue to cause great resentment among many Afghans. Movement on the detention issue had also stalled, causing a deadlock.

Faizi said once a deal was reached on the transfer of detention centres, both sides would attempt to draw up a memorandum of understanding on the night raids.

(Reporting by Michael Georgy; Editing by Sanjeev Miglani)