Libya's deputy intelligence chief Mustafa Nuh was freed by his abductors on Monday a day after they seized him near Tripoli airport, a source in the intelligence services said.
"Nuh was freed today," the source said on condition of anonymity, without giving further details.
On Sunday, private television channel Al-Naba had quoted a witness who escaped the abduction as describing the incident.
Former rebel commander Ala Abu Hafess told Al-Naba he was in a car with Nuh when they were ambushed as they left the airport.
Gunmen forced them out of their car and into another vehicle, Abu Hafess said, adding that he was able to flee by jumping out of the car.
"I ran. They opened fire at me but didn't hit me," he said.
The abduction of the deputy intelligence chief, who is originally from the western coastal city of Misrata, came amid high tensions between armed groups from his hometown and rival groups in Tripoli.
More than 40 people have been killed and hundreds wounded since Friday when residents of the capital rose up against the continued presence in the city of a Misrata militia.
The violence, the deadliest in Tripoli since the 2011 revolt that toppled long-time dictator Moamer Kadhafi, left 43 people dead and more than 450 wounded, the health ministry said.