Kabul, Afghanistan (CNN) -- The United States and Afghanistan signed a landmark deal Sunday that affords Afghan authorities an effective veto over controversial special operations raids.
A bid to end visceral Afghan anger over raids on private residences, the deal prevents NATO's International Security Assistance Force (ISAF) from conducting such operations without the explicit permission of Afghan officials, said a senior NATO official.
It was not clear, however, whether the deal ceded 100% of U.S. capabilities over special forces operations, ISAF's key tactic against the insurgency.
From now on, an Afghan review group will have to authorize an operation before it goes ahead, the official said.
And special operations forces will operate under Afghan law, said a statement from the presidential palace.
Afghan Defense Minister Abdul Rahim Wardak and ISAF commander Gen. John Allen signed the agreement at the Afghan foreign ministry Sunday afternoon.
"The Afghan special operations unit has developed at extraordinary speed" and is "manned by courageous and capable operators," Allen said at the ceremony. "Today we are on an important step closer to our shared goal of a secure and sovereign Afghanistan. Together we will realize this vision."
U.S. Ambassador Ryan Crocker said the agreement was an "important illustration" of partnership.
"We are making sure this transition is not abrupt, but a path marked by benchmarks and steps that build Afghan capacity," Crocker said in a statement. "This (agreement) marks another major step towards our goal of ensuring a stable, secure and sovereign Afghanistan and of forging an enduring partnership with the government and people of Afghanistan."
The key deal comes after months of recriminations against special operations raids, particularly at night, that deeply offend Afghans, as they involve foreigners entering their homes.
U.S. officials say the raids are vital to NATO's operation against insurgents.
The complex system will fully "Afghanize" the operations, putting Afghan commandos in the lead and giving American special forces a "training and support role," a senior Afghan official said.
The official said the deal mandates a committee of Afghan officials with U.S. input, known as the Operational Coordination Group, to review U.S. intelligence on a target before a raid.
If that target is approved, that will constitute authority for the operation under Afghan law, the official said. Afghan officials have insisted the raids be conducted in compliance with Afghan law.
A senior Afghan official with sight of the agreement said the search of "residential houses or private compounds" can now only be conducted by Afghan special forces.
U.S. special forces will be on the ground in all special operations, but they will not enter the home of an Afghan unless specifically asked to do so by the Afghan commandos leading the operation, or by other Afghan officials, the senior NATO official added.
In the year since February 2011, 22% of special operations had occurred at night, the NATO official said.
The Afghan official said a new bilateral group will also be established, led by Wardak, the defense minister, and NATO's Allen. It will have oversight over the "Afghanization of special operations" and resolve any disputes.
A U.S. military officer involved in the negotiations declined to discuss whether Americans would still carry out any special operations unilaterally, without Afghan approval.
Last week, the Pentagon said 97% of night raids were joint between Afghan and U.S, special forces, leaving open the possibility that some were just performed by U.S. commandos.
Afghan Defense Ministry spokesman Zahir Azimi told CNN Sunday that the 97% figure was accurate. He said the remaining 3% referred to cases when U.S. forces acquire intelligence on foreigners like al Qaeda members or other senior foreign militants that "need special and quick reaction."
The Obama administration has previously stated that the United States will go after key al Qaeda targets and militants, regardless of where they are.
Talks have been going on for weeks on this key memorandum of understanding to address what is perhaps the most difficult issue in the partnership between Kabul and Washington.
The agreement removes one of the obstacles in the way of a highly symbolic Strategic Partnership Document, outlining the basis for U.S.-Afghan cooperation for the years after NATO's 2014 drawdown.
Night raids also present a particular challenge to Afghan President Hamid Karzai. Their strong unpopularity has forced the president to demand they stop, or at least no longer involve foreign troops, despite their operational significance to NATO.
Allen told Congress last month how vital and frequent those raids are.
In 2011, 83% of the raids succeeded in detaining or striking either their primary target or an associated insurgent, he said.
"This last year, we had about 2,200 night operations," Allen told the Senate Armed Services Committee.
"Of those 2,200 or so night operations, on 90% of them we didn't fire a shot. On more than 50% of them we got the targeted individual, and (in) 30% more we got the next associate of that individual as well."
As for civilian casualties, in the 10% of the night raids where shots were fired, "less than 1.5 % civilian casualties" resulted, Allen said.
Karzai has said Afghanistan's homes and villages need to be safe and protected.
"What we are asking for, in very specific and clear terms, (is that) no foreign forces should enter Afghan homes," he said last year.