WASHINGTON - Facing the possibility that President Obama might not win a second term, his administration accelerated work in the weeks before the election to develop explicit rules for the targeted killing of terrorists by unmanned drones, so that a new president would inherit clear standards and procedures, according to two administration officials.

The matter may have lost some urgency after Nov. 6. But with more than 300 drone strikes and 2,500 people killed by the CIA and the military since Obama took office, the administration is still pushing to make the rules formal and resolve internal uncertainty and disagreement about exactly when lethal action is justified.

Obama and his advisers are still debating whether remote-control killing should be a measure of last resort against imminent threats to the United States or a more flexible tool, available to help allied governments attack their enemies or to prevent militants from controlling territory.

Though publicly the administration presents a united front on the use of drones, there is longstanding tension behind the scenes. The Defense Department and the CIA continue to press for greater latitude to carry out strikes; Justice Department and State Department officials, and the president's counterterrorism adviser, John Brennan, have argued for restraint, officials involved in the discussions say.

More broadly, the administration's legal reasoning has not convinced many other countries that the strikes are acceptable under international law. For years before the Sept. 11, 2001, attacks, the United States routinely condemned targeted killings of suspected terrorists by Israel, and most countries still object to such measures.

But since the first targeted killing by the United States in 2002, two administrations have taken the position that the United States is at war with Al-Qaida and its allies and can legally defend itself by striking its enemies wherever they are found.

An urgent course of action

The attempt to write a formal rule book for targeted killing began last summer after news reports on the drone program, started under President George W. Bush and expanded by Obama, revealed some details of the president's role in the shifting procedures for compiling "kill lists" and approving strikes. Though national security officials insist that the process is meticulous and lawful, the president and top aides believe it should be institutionalized, a course of action that seemed particularly urgent when it appeared that Mitt Romney might win the presidency.

"There was concern that the levers might no longer be in our hands," said one official, speaking on condition of anonymity. With a continuing debate about the proper limits of drone strikes, Obama did not want to leave an "amorphous" program to his successor, the official said. The effort, which would have been rushed to completion by January had Romney won, will now be finished at a more leisurely pace, he said.

Obama himself, in little-noticed remarks, has acknowledged that the legal governance of drone strikes is still a work in progress.

In an interview with Mark Bowden for a new book on the killing of Osama bin Laden, "The Finish," Obama said that "creating a legal structure, processes, with oversight checks on how we use unmanned weapons, is going to be a challenge for me and my successors for some time to come."

The president expressed wariness of the powerful temptation drones pose to policymakers. "There's a remoteness to it that makes it tempting to think that somehow we can, without any mess on our hands, solve vexing security problems," he said.