TRIPOLI, Libya – Libyans hunting Moammar Gadhafi offered a $2 million bounty on the fallen dictator’s head and amnesty for anyone who kills or captures him as rebels battled Wednesday to clear the last pockets of resistance from the capital, Tripoli.

While some die-hard loyalists kept up the fight to defend Gadhafi, his support was crumbling by the hour. His deputy intelligence chief defected, and even his foreign minister said his 42-year rule was over.

A defiant Gadhafi vowed from hiding to fight on “until victory or martyrdom,” in an audio message early Wednesday. He may have little choice. Asked by the British broadcaster Channel 4 if a negotiated settlement or safe passage for Gadhafi from Libya was still possible, Foreign Minister Abdul Ati al-Obeidi said: “It looks like things have passed this kind of solution.”

Rebel leaders were beginning to set up a new government in the capital. Their interim administration, the National Transitional Council, has been based in the eastern city of Benghazi, which fell under rebel control shortly after the outbreak of widespread protests in February.

“Members of the council are now moving one by one from Benghazi to Tripoli,” said Mansour Seyf al-Nasr, the Libyan opposition’s new ambassador to France.

Rebel officials are eager to prove they can bring a stable political future, and that their movement is more than an often-fractious collection of tribes, ethnicities and semiautonomous militias.

Mahmoud Jibril, head of the opposition government, outlined plans for a new constitution and elections and said officials were talking to the U.N. about sending monitors to help ensure security in Tripoli.

A day after rebels captured Gadhafi’s vast Bab al-Aziziya compound, the symbolic center of his regime, loyalists were firing into the compound from an adjacent neighborhood where intense clashes broke out.