The top crime-fighting official in President Hamid Karzai's cabinet announced his resignation Tuesday after complaining publicly for months about corruption in the government.

Interior Minister Ali Ahmad Jalali, 63, a former journalist, said in an interview with Tolo television that he was stepping down to pursue a career in academia.

Close friends of Jalali, however, said he had expressed frustration with Karzai's decisions to keep powerful factional leaders, including some linked to Afghanistan's burgeoning drug trade, in appointive government posts.

In several incidents of serious violence Tuesday, a U.S. soldier and a U.S. Marine were killed in separate attacks by insurgents, U.S. military officials said, and an Afghan candidate for parliament was shot to death by unidentified gunmen.

The soldier was taking part in a joint U.S.-Afghan ground assault near the southern city of Kandahar when his vehicle came under fire from rocket-propelled grenades and small arms. Another U.S. soldier was wounded and two insurgents were killed.

The Marine was killed when his base in the northeastern province of Konar came under mortar, grenade and small-arms fire, according to a U.S. military statement. The deaths brought the number of U.S. forces killed in combat in Afghanistan this year to 53.

The parliamentary candidate died when gunmen fired into his car in the northern city of Mazar-e Sharif, also killing a passenger and injuring the driver and a bodyguard, government officials reported.

Ashraf Ramazan, an ethnic Hazara leader who was seeking one of 11 seats from Balkh province in the Sept. 18 elections, was running fifth, according to preliminary election results. Final returns are expected to be announced in early October.

Ramazan's death has raised fears of many more killings, spurred by an election rule that says any winning candidate who dies before taking office will be replaced by the next-highest vote-getter.

Jalali, the former interior minister, was widely considered a committed leader in the government's effort to pacify the country, which has been racked by increased political violence since last spring. He was first appointed in January 2003, then renamed to a cabinet that had been largely purged of warlords and was dominated by Western-oriented technocrats after Karzai's electoral victory in October.

Aides to Karzai denied any rift between the two men, who are related by marriage. "Jalali has had the full confidence of the president," said Khaleeq Ahmad, a presidential spokesman. "He has done an excellent job. . . . He was probably one of the closest advisers to the president."

However, in the television interview aired Tuesday, Jalali hinted that his power to fire governors and provincial police officials had sometimes been curtailed.

In general, he said, "the Interior Ministry would recommend people and the president would approve them. But sometimes, for political reasons, the decision on which governor to appoint was made by the national security council."

Among the moves that Jalali privately decried, a close friend and former colleague said, was the transfer of Gul Agha Shirzai, a controversial former militia leader, from one governorship to another.

"He was not happy with the president's interference in his work," the friend said.

During news conferences, Jalali had hinted he might make public the names of government officials implicated in Afghanistan's opium trade, which now accounts for nearly 90 percent of the world's heroin supply.