Colonel Gaddafi's son Saif al-Islam has been captured, Libyan officials say.
He was taken by fighters near the southern town of Obari and flown to the city of Zintan in the north. Saif al-Islam told a journalist he was well.
He is the last key Gaddafi family member to be seized or killed. Libya's new prime minister says he will get a fair trial in Libya.
Saif al-Islam, 39, is wanted by the International Criminal Court (ICC) for alleged crimes against humanity.
A militia force allied to the ruling National Transitional Council (NTC) said he had been captured in the desert about 50km (30 miles) west of Obari, and taken to their base in Zintan in the north.
A commander of the Zintan militia, Wisam Dughaly, said Saif al-Islam had been captured along with several aides as they tried to smuggle him out to neighbouring Niger.
Fighters said they were taken without a shot being fired.
"At the beginning he was very scared. He thought we would kill him," one of his captors, named as Ahmed Ammar, told Reuters news agency.
Libyan TV showed pictures of Saif al-Islam on the plane to Zintan with bandages on his left hand.
Asked by Reuters reporter Marie-Louise Gumuchian during the flight if he was feeling all right, he said simply: "Yes." He added that he had been injured in a Nato air strike a month ago.
Interim Prime Minister Abdurrahim al-Keib told reporters in Zintan: "We assure Libyans and the world that Saif al-Islam will receive a fair trial."
He added that he was happy for him to remain in Zintan rather than be transferred to the capital, Tripoli.
"Our brothers and sisters here and the authorities are definitely trustworthy. We trust their ability to be able take care of this person," Mr Keib said.
The Zintan fighters, who make up one of the powerful militia factions in the country, have said they plan to keep Saif al-Islam until they could hand him over to Tripoli.
Information Minister Mahmoud Shammam said Gaddafi's son would face justice in Libya itself.
ICC spokesman Fadi el-Abdallah told the BBC that Libya had a legal obligation to hand Saif al-Islam over to the court, and that the final decision on a trial venue was up to ICC judges after consultations with Tripoli.
ICC prosecutor Luis Moreno Ocampo said he was travelling to Libya for talks on the issue, adding: "The news is Saif will get justice. Where and how, that we will discuss."
The European Union urged Libyan authorities to ensure that Said al-Islam is brought to justice in full co-operation with the ICC.
British Prime Minister David Cameron called on the country's leaders to ensure he was tried "in line with international standards".
The capture leaves Gaddafi's former intelligence chief, Abdallah Senoussi, as the only Libyan ICC suspect still at large.
Saif al-Islam had been on the run since NTC forces took Tripoli in August, six months into the uprising.
Colonel Gaddafi himself was killed on 20 October after being captured during the final battle for his hometown, Sirte.
The interim government in Libya has launched an inquiry into how he died.
The BBC's Rana Jawad in Tripoli says Saif al-Islam's capture is a very significant moment for Libyans.
They came to see Saif al-Islam as the heir apparent, as a younger version of his father due to his rhetoric during the uprising, she says.
However, at one time he was considered one of the more liberal of Col Gaddafi's sons and was courted in the West.
Celebrations erupted on the streets of Tripoli shortly after the news of his arrest emerged.
Our correspondent heard people hooting car horns, waving flags and firing guns into the air.
Saif al-Islam has been reported captured before. In August, rebel forces announced his arrest as they took control of Tripoli - only for him to appear in front of cameras to disprove it.