Yes, he said, he was detained by Malaysian officials in 2004 on arrival at the Kuala Lumpur airport, where he was subjected to extraordinary rendition on behalf of the United States, and sent to Thailand. His pregnant wife, traveling with him, was taken away, and his child would be 6 before he saw him.

In Bangkok, Mr. Belhaj said, he was tortured for a few days by two people he said were C.I.A. agents, and then, worse, they repatriated him to Libya, where he was thrown into solitary confinement for six years, three of them without a shower, one without a glimpse of the sun.

Now this man is in charge of the military committee responsible for keeping order in Tripoli, and, he says, is a grateful ally of the United States and NATO.

And while Mr. Belhaj concedes that he was the emir of the Libyan Islamic Fighting Group, which was deemed by the United States to be a terrorist group allied with Al Qaeda, he says he has no Islamic agenda. He says he will disband the fighters under his command, merging them into the formal military or police, once the Libyan revolution is over.

He says there are no hard feelings over his past treatment by the United States.

“Definitely it was very hard, very difficult,” he said. “Now we are in Libya, and we want to look forward to a peaceful future. I do not want revenge.”

As the United States and other Western powers embrace and help finance the new government taking shape in Libya, they could face a particularly awkward relationship with Islamists like Mr. Belhaj. Once considered enemies in the war on terror, they suddenly have been thrust into positions of authority — with American and NATO blessing.

In Washington, the Central Intelligence Agency declined to comment on Mr. Belhaj or his new role. A State Department official said the Obama administration was aware of Islamist backgrounds among the rebel fighters in Libya and had expressed concern to the Transitional National Council, the new rebel government, and that it had received assurances.

“The last few months, we’ve had the T.N.C. saying all the right things, and making the right moves,” said the official, who spoke on condition of anonymity because of the matter’s delicacy.

Mr. Belhaj, 45, a short and serious man with a close-cropped beard, burst onto the scene in the mountains west of Tripoli only in the last few weeks before the fall of the capital, as the leader of a brigade of rebel fighters.

“He wasn’t even in the military council in the western mountains,” said Othman Ben Sassi, a member of the Transitional National Council from Zuwarah in the west. “He was nothing, nothing. He arrived at the last moment, organized some people but was not responsible for the military council in the mountains.”

Then came the push on Tripoli, which fell with unexpected speed, and Mr. Belhaj and his fighters focused on the fortified Bab al-Aziziya compound of Col. Muammar el-Qaddafi, where they distinguished themselves as relatively disciplined fighters.

A veteran of the war in Afghanistan against the Soviets, Mr. Belhaj has what most rebel fighters have lacked — actual military experience. Yet he has still not adopted a military rank (unlike many rebels who quickly became self-appointed colonels and generals), which he said should go only to members of the army.

Dressed in new military fatigues, with a pistol strapped backward to his belt, Mr. Belhaj was interviewed at his offices in the Mitiga Military Airbase in Tripoli, the site of what had been the United States Air Force’s Wheelus Air Base until 1970.

Last weekend, Mr. Belhaj was voted commander of the Tripoli Military Council, a grouping of several brigades of rebels involved in taking the capital, by the other brigades, a move that aroused some criticism among liberal members of the council.

However, his appointment was strongly supported by Mustafa Abdel-Jalil, the chairman of the council, who said that as Colonel Qaddafi’s former minister of justice he got to know Mr. Belhaj well during negotiations leading to his release from prison in 2010. Mr. Belhaj and other Islamist radicals made a historic compromise with the Qaddafi government, one that was brokered by Seif al-Islam el-Qaddafi, the Qaddafi son seen then as a moderating influence.