TRIPOLI, Libya — Tunisian authorities arrested Moammar Gadhafi's former prime minister on Thursday as Libya's new rulers and NATO warned the fugitive leader and his loyalists that they are running out of places to hide.

The U.S. ambassador to Libya Gene Cretz said Gadhafi and his loyalists would eventually be routed, and he pledged continued support for the country's new leadership.

"The next few months will be critical as Libyans lay the groundwork for a pluralistic democracy that respects the rights of all of its citizens," he said in remarks before the flag was raised in front of his residence in Tripoli. "The United States and the international community are ready to help in any way we can."

The American Embassy's main compound was attacked and severely damaged by a pro-Gadhafi mob with the onset of the NATO campaign in March. Embassy staff had already been evacuated as unrest spread after the start of the uprising in mid-February. Cretz had left the country for consultations in Washington a month earlier after WikiLeaks posted his opinions of Gadhafi's personal life and habits in a classified 2009 diplomatic cable. He said he had been physically threatened. He returned on Wednesday.

"At that time, I could not imagine that I would be returning to a new, free Libya that is brimming with joy, optimism and newfound freedoms," he said.

Despite the optimism, Libya's new rulers are struggling to consolidate their control over the entire country. Gadhafi remains at large, and his whereabouts unknown. His supporters are well-armed and fighting is still raging on three fronts in Libya a month after revolutionary forces seized control of the capital, Tripoli and brought down his regime. There is concern that as long as Gadhafi and other top regime figures are not captured, they could foment significant instability.

Gadhafi's former Prime Minister Al-Baghdadi al-Mahmoudi was arrested overnight with two other people after they were found without visas in the southern town of Tameghza, near Tunisia's border with Algeria, ministry spokesman Hichem Meddeb said Thursday.

The three were questioned by the state prosecutor and sentenced in court to six months in prison for illegal entry, effective immediately, Justice Ministry spokesman Kadhem Zine El Abidine. Al-Baghdadi had been trying to flee into Algeria, he added.

Al-Mahmoudi is not among the former Gadhafi allies being sought by the International Criminal Court.

The U.S. ambassador Cretz said one of the biggest priorities for the Americans was helping the Libyans stop the proliferation of weapons that have gone missing from Gadhafi's once vast arsenal. In particular, the U.S. has sought to keep track of Libya's unconventional weapons experts during the civil war.

Gadhafi agreed to dismantle his weapons of mass destruction research and production programs as part of efforts to normalize relations with the international community as he faced intense economic pressure from international sanctions. But he never completed the process.

A U.N. official said Libyans had found uranium yellowcake, partly refined uranium ore, that was left over from the former regime's nuclear program. The official, who spoke on condition of anonymity because he wasn't authorized to release the information, said the material was "slightly radioactive" but posted no real danger. He didn't know how much had been found or where it was found.

Separately, fighters from Misrata said in a statement Thursday that they are in control of chemical weapons near Gadhafi's hometown of Sirte — one of the three areas where loyalists continue to put up stiff resistance. They said they are safeguarding any possible chemical weapons until the arrival of a U.N. team, which will oversee their transfer.

"We are looking for a peaceful country and we don't want these kinds of weapons to stay in it," the statement said.

The Canadian general commanding NATO's mission in Libya said that isolated groups of Gadhafi supporters continue to be a threat to local people but are unable to coordinate their actions.

Lt. Gen. Charles Bouchard said in a conference call with reporters that many Gadhafi forces are surrounded with no way out. On Wednesday, NATO's decision-making body, the North Atlantic Council, granted approval to extend the mission for another 90 days. Without an extension, permission for the operation would have expired Sept. 27.

"We are now at a point where I can only urge regime forces to surrender, to bring an end to these activities," Bouchard said.

Despite their isolation, the general said, Gadhafi's forces "are still dangerous ... and violence against the population continues."

Bouchard said he had no idea where Gadhafi was hiding.

Government forces this week have made inroads against Gadhafi loyalists in Sabha, the last major city in Libya's far south on a key road leading to the border with Niger.

"Well, I don't think there are too many places left in Libya for regime forces to go," Bouchard said. "The (Gadhafi) forces are no longer capable of coordinated action anywhere in the country. ... What we are now witnessing is tactical, very localized action."

Libya's new rulers insist the holdouts in Gadhafi's hometown of Sirte, Bani Walid and Sabha are die-hard supporters, including many who escaped Tripoli, and believe they have no choice but to resist or face war-crimes charges. A military spokesman for the National Transitional Council, Col. Ahmed Bani, said the revolutionaries had unconfirmed information that Gadhafi had been in Sabha but escaped.

Comment on this story

Bani also warned the holdouts that it was only a matter of time before revolutionary forces secure the country. He claimed former rebels had captured key areas in the southern desert, including the towns of Hun, Waddan, Zalaa and most of Sabha, although they still faced pockets of resistance.

"Resistance is hopeless," he said at a news conference. "Now they are just fighting for themselves, they are not fighting on the tyrant's behalf."

NATO launched 44 strike sorties Wednesday on Libya pushing the total number of strikes on Libya to nearly 8,800 since late March, according to a statement released Thursday. The Western military alliance said it struck military targets Wednesday in Sirte and Hun.

Associated Press writers Bouazza Ben Bouazza in Tunis, Tunisia, and George Jahn in Vienna contributed to this report.