WASHINGTON — The United States and Afghanistan are close to clinching an agreement that will give Kabul more authority over night-time raids, resolving an issue that threatened to derail negotiations on a long-term US military presence, US officials said Tuesday.

"An agreement is days away," a US official, who spoke on condition of anonymity, told AFP.

The deal on night raids could be announced as soon as this week, paving the way for a strategic partnership agreement governing the future of US forces beyond 2014, when the bulk of American and NATO troops are due to withdraw, US officials said.

Night raids by special forces against insurgent hideouts have triggered popular anger and long been a source of friction with Afghan President Hamid Karzai, who has denounced the NATO operations as reckless.

The deal taking shape would put Afghans in the lead for night raids and call for Afghan judges to issue warrants for the operations, officials said.

Negotiators from both governments were working out a final sticking point over how long US forces would be allowed to detain suspects picked up in the raids, a US official said.

The Afghans wanted suspects promptly transferred to their control while the Americans wanted to hold on to the detainees for a period of days to interrogate them and gather intelligence, said the official, who spoke on condition of anonymity.

The memorandum of understanding on night raids would allow Karzai to demonstrate he was bolstering Afghan sovereignty without forcing a halt to operations, the official said.

It was also possible that the warrants from Afghan judges could be issued after a night raid was conducted, the official said.

The outlines of the deal were first reported by the Wall Street Journal.

A Pentagon spokesman expressed optimism Tuesday that a deal was near.

"We believe we're making progress in heading toward an agreement on this and a broad range of other issues," Pentagon press secretary George Little told a news conference.

The issue of night raids "has been a concern of the Afghan government for some time. We recognize that. We recognize the effectiveness as well that night operations have had over time," he said.

"And that's why we're working through an agreement with our Afghan partners."

Despite Karzai's criticism that the raids amount to harassment of local communities, NATO has defended the operations as the safest way of targeting insurgent leaders.

The top commander of US and NATO forces in Afghanistan, General John Allen, told the Senate Armed Services Committee last month that 2,200 night raids were carried out last year. In 90 percent of the operations, no shots were fired and civilian casualties rarely occurred, according to Allen.

An agreement that will outline the role of US forces beyond 2014 had been held up by disagreements over night raids and the future of detainees held at a US-run prison.

The two sides signed a deal earlier this month on transferring Afghan detainees to the Kabul government's custody and now a memorandum on night raids should remove the last obstacle to final negotiations on a long-term security agreement, which US officials hope to ink in time for a NATO summit in May in Chicago.

US military officers envisage a follow-on force of roughly 15,000 that would focus on air power, logistics, training, intelligence and counter-terror operations.

US and Afghan officials will need to hammer out what bases and runways American forces would permitted to operate from and what legal protections will be granted to US troops.

Secretary of State Hillary Clinton, on a visit Tuesday to NATO's base in Norfolk, Virginia, said that the United States would not "abandon" Afghanistan and anticipated a "small number" of forces to remain after 2014.

"But we do not seek any permanent American military bases in Afghanistan or a presence that is considered a threat to the neighbors," Clinton said.

In Iraq, talks on a follow-on US force collapsed last year as Baghdad was unwilling to grant American soldiers legal immunity from prosecution.