The United States and Afghanistan signed a deal Sunday giving the Afghans control over night military operations, resolving a major source of friction between President Hamid Karzai and Washington.

The agreement removes a key obstacle to a long-term strategic partnership between the two countries, including a U.S. military presence in Afghanistan after 2014, when all foreign combat troops are set to leave the country.

Under the deal, a newly formed national force — the Afghan Special Operations Unit — will have the authority to search houses and private compounds and arrest suspected insurgents, Afghanistan’s Defense Minister Abdul Rahim Wardak told the Washington Post Sunday. U.S. forces will provide support “only as required or requested,” according to the agreement, which was signed by Wardak and General John R. Allen, the commander of the U.S. forces in Afghanistan.

Under the agreement, Afghan authorities will have control over prisoners taken in night raids and decide whether to allow U.S. interrogators access to detainees, NBC reported.

An Afghan judge would also have to grant a warrant approving operations, although the document said Afghan authorities would have to set up judicial processes capable of issuing timely and operationally secure judicial authorizations.

Only Afghan forces, the document says, will be able to search residential homes or compounds, while Afghan police and soldiers would have to protect women and children, as well as culturally sensitive places.

A joint U.S.-Afghan committee will decide which raids to carry out and an Afghan judge must then review its recommendation and decide whether to issue a warrant.

“This is ... a landmark day for the rule of law in Afghanistan,” Allen said during a signing ceremony. “This means that Afghan security forces operating under Afghan law will now be responsible for capturing and detaining the terrorists who try to kill and wound the innocent people of Afghanistan.”

Many Afghans in the south and east of the country, the main bastions of the insurgents and the focus of the night operations by U.S. and NATO forces, have repeatedly complained about the raids, charging that they violate their privacy, create panic among the population and result in civilian casualties.

The targeted operations are expected to remain a key part of military strategy through 2014 — a viable way of crippling terrorist networks, officials said, even as NATO troops continue leaving the country by the thousands. The operations will still be based on U.S. intelligence, and, for now, Afghan forces will continue to depend on U.S. airstrikes during the raids, according to the agreement.

About 3,000 night operations have been conducted during the past 14 months, with suspects apprehended 81 percent of the time, U.S. officials said last week.

Afghan officials called the agreement on night operations a significant breakthrough in relations between the two countries. The other major hurdle to a long-term strategic partnership was removed last month when U.S. and Afghan officials signed an agreement to hand over the largest U.S. military prison in the country.

Shaida Mohammad Abadali, deputy head of Afghanistan’s national security council, said the deal addresses “our years-long demand for full respect to Afghan sovereignty.”