Prime minister Abdurrahim el-Keib has sent Libya on a bumpy road towards democracy by naming a cabinet of secularists and thereby snubbing prominent Islamists.

The biggest surprise on the list was Osama al-Juwali, chief of the Zintan military council, who was appointed defence minister at the expense of Islamist Hakim Bilhaj.

Juwali is an accomplished commander whose forces were originally a militia from the small city of Zintan that went on to play a central role in storming Tripoli in August, but until now he had no national political profile. Sources in the city in west Libya told the Guardian at the weekend its leadership demanded a cabinet post in return for handing over Saif al-Islam, Muammar Gaddafi's son and heir, captured in the south on Saturday. He is now held at a secret location in Zintan.

In Tripoli, the international criminal court's chief prosecutor, Luis Moreno Ocampo, confirmed the ICC had accepted Saif al-Islam would be tried in Libya, but said it would take part and "help" the authorities guarantee him a fair trial. The court would ensure its judges had a role, Ocampo said.

In the new cabinet, there was no place for financial strategist Ali Tarhuni, previously minister for oil, gas and finance. He was expected to get the finance portfolio, but Keib picked Hassan Ziglan, thereby removing Tarhuni from what had been the key economic role in the National Transitional Council (NTC) government. As expected, the job of running the oil and gas was given to a technocrat.

The other loser was Abdul Hakim Bilhaj, who fought the Gaddafi regime, backed by Qatar and the United Arab Emirates, and was expected to win a place after stating he now supports democracy and the rule of law.

The cabinet is likely to find approval from Libya's western backers, concerned about hardline Islamists; President Mustafa Abdul Jalil had declared previously that sharia law will form the basis of a new constitution. But the failure to include Bilhaj raises a question as to how stable the new transitional authority will be. Its chief task is to draft a constitution and to oversee elections next year.

There were signs of tension, with NTC members apparently being unhappy and reopening discussions after the list was agreed. "There are some people who do not accept some of the names," a source, speaking on condition of anonymity, told Reuters. It was not clear which posts were the subject of debate.

Mohammed Alagi, expected to be confirmed as justice minister, had reaffirmed that "no way" would Saif al-Islam be handed over to the ICC in The Hague. Alagi was speaking before meeting Ocampo; the latter said he had flown to Libya to ensure the NTC co-operated fully with the international war crimes tribunal and to help it organise a fair trial for Saif al-Islam and for Abdullah Sanussi, the former intelligence chief, both indicted by the ICC for crimes against humanity.

"They have decided to do it [hold a trial] and that is why we are here to learn and to understand what they are doing, and to co-operate," Alagi said. "The law says the primacy is for the national system. If they prosecute the case here, we will discuss with them how to inform the judges and they can do it. But our judges have to be involved."

Libya can impose the death penalty; the ICC's maximum sentence is life imprisonment. Saif al-Islam was betrayed by a desert guide, hired to smuggle him to Niger, who tipped off fighters from Zintan who ambushed his two-car convoy. The International Committee of the Red Cross said it had visited Saif and he appeared in good health.

Officials claimed Gaddafi's youngest son, Khamis, reported dead several times, is trapped in Terhouna, a town 60 miles south of Tripoli; the NTC said his capture was imminent. A tip-off may have come from Saif al-Islam, reports suggested; he led rebel fighters to Senussi's southern hideout. The eponymous Khamis brigade is blamed for war crimes around Misrata; it was the most effective Gaddafi unit, battling rebels all the way back to Tripoli, and later holding the line at Sirte.

• This article was amended on 23 November 2011 to correct the spelling of the Libyan prime minister's name. It was further amended on 24 November 2011 to remove an incorrect statement that Abdul Hakim Bilhaj had fought alongside the Taliban in Afghanistan and been jailed in Guantánamo Bay.