Updated

Libya insisted Wednesday it will put a son of deposed ruler Moammar Gadhafi on trial itself, just as the chief prosecutor of the International Criminal Court flew to Tripoli to look into his case and that of Gadhafi's notorious spy chief.

The Hague-based court is locked in a legal tug-of-war with Libya's ruling National Transitional Council over who should try Seif al-Islam Gadhafi, once considered his father's heir apparent. He was captured last year in Libya after a civil war that toppled the Gadhafi regime.

Libyan spokesman Nasser al-Manei emphasized his government's decision not to hand over Gadhafi's son.

"Procedures are going forward to try all former regime figures, including Seif," al-Manei told reporters.

Questions have been raised about the new government's ability to build a judicial system reliable enough to try a figure like Seif al-Islam Gadhafi. Another key challenge is ending extrajudicial detentions by powerful militias.

The government statement cast a shadow over the visit of the prosecutor, Luis Moreno-Ocampo, who was expected to press the ICC's case for taking over the trial of Gadhafi's son.

Moreno-Ocampo told The Associated Press at Tripoli's airport that he would also follow up on the case of Abdullah al-Senoussi, Gadhafi's spy chief, who is accused of attacking civilians during the uprising, as well as complicity in the 1989 bombing of a French airliner.

He later told Al-Jazeera TV that the Libyan government has to make a case to the international court that it can conduct fair trials for the detainees.

National Transitional Council spokesman Mohammed al-Hareizi told the station the deadline for such an appeal is the end of the month. He did not say if Libya would comply.

Al-Senoussi was captured last month in Mauritania, where courts are reviewing requests for his extradition from Libya and France as well as the ICC.

Al-Manei said his government is in talks with those countries to bring al-Senoussi to Libya for trial.

Since the end of Libya's civil war with the capture and killing of Gadhafi last October, the new government has struggled to extend its control over the vast desert nation. It has largely failed to rein in the hundreds of militias that fought in the war. They rule much of the country in the absence of an effective central government and military.

Seif al-Islam had been held until now by his captors, ex-rebels from the town of Zintan. For months, the Zintan militia refused to give him up to Tripoli's officials. Al-Manei said he will be soon transferred to Tripoli, declining to give a date.

"The Justice Ministry is working to establish a strong judicial system across Libya ... capable of providing fair trials," he said, noting that a number of new courts have been set up in Misrata and Zawiya for trials of former regime officials.

International observers and organizations can attend, he said.

Moreno-Ocampo said he would also travel to the coastal city of Misrata to investigate allegations of abuse in detention facilities run by militiamen who fought Gadhafi's forces.

Al-Manei said his government is negotiating to take over those facilities from the militias. The government took control of three makeshift prisons with more than 1,000 inmates in Misrata Wednesday, he said.

In February, Amnesty International accused militias of torturing detainees deemed loyal to Gadhafi's regime and driving out residents of entire neighborhoods and towns.

"We want to know how Libya will deal with war crimes, and how are they investigating the crimes," Moreno-Ocampo told the AP. "Right now, we are focusing on the rape crimes. The next investigation will be decided after we see what the government is planning to do."