Libyan leader Col Muammar Gaddafi's security forces detained and beat up a BBC news team who were trying to reach the strife-torn western city of Zawiya.
The three were beaten with fists, knees and rifles, hooded and subjected to mock executions by members of Libya's army and secret police.
The men were detained on Monday and held for 21 hours, but have now flown out of Libya.
Government forces are in a fierce fight to wrest Zawiya from rebel control.
Artillery and tanks have pounded the city - which lies 50km (30 miles) from the capital Tripoli - over the last four days.
'Gun against neck'
The BBC team showed their identification when they were detained at an army roadblock on Monday.
They had been seeking, like many journalists, to get around government restrictions by reaching besieged Zawiya.
The three of them were taken to a huge military barracks in Tripoli, where they were blindfolded, handcuffed and beaten.
One of the three, Chris Cobb-Smith, said: "We were lined up against the wall. I was the last in line - facing the wall.
"I looked and I saw a plain-clothes guy with a small sub-machine gun. He put it to everyone's neck. I saw him and he screamed at me.
"Then he walked up to me, put the gun to my neck and pulled the trigger twice. The bullets whisked past my ear. The soldiers just laughed."
A second member of the team - Feras Killani, a correspondent of Palestinian descent - is said to have been singled out for repeated beatings.
Their captors told him they did not like his reporting of the Libyan popular uprising and accused him of being a spy.
The third member of the team, cameraman Goktay Koraltan, said they were all convinced they were going to die.
During their detention, the BBC team saw evidence of torture against Libyan detainees, many of whom were from Zawiya.
'Abusive treatment'
Koraltan said: "I cannot describe how bad it was. Most of them [other detainees] were hooded and handcuffed really tightly, all with swollen hands and broken ribs. They were in agony. They were screaming."
Killani said: "Four of them [detainees] were in a very bad situation. There was evidence of torture on their faces and bodies. One of them said he had at least two broken ribs. I spent at least six hours helping them drink, sleep, urinate and move from one side to another."
A senior Libyan government official later apologised for the BBC team's ordeal.
But the BBC said in a statement that it "strongly condemns this abusive treatment".
"The safety of our staff is our primary concern especially when they are working in such difficult circumstances and it is essential that journalists working for the BBC, or any media organisation, are allowed to report on the situation in Libya without fear of attack," said the statement from Liliane Landor, languages controller of BBC Global News.
"Despite these attacks, the BBC will continue to cover the evolving story in Libya for our audiences both inside and outside the country."
Rebel bounty
Government forces have been mounting a strong fightback against the rebels who rose up in mid-February to end Col Gaddafi's 41 years in power.
The main square of Zawiya reportedly changed hands twice on Wednesday in the fighting between pro-Gaddafi forces and the insurgents.
State TV reported that the army had retaken Zawiya, and showed pictures of what it said were residents staging a pro-Gaddafi rally.
On the eastern front around the Mediterranean oil port of Ras Lanuf, rebels retreated in the face of heavy government shelling and ongoing air strikes, amid reports that oil facilities were blown up.
Col Gaddafi also launched a diplomatic offensive, dispatching envoys overseas on the eve of a summit by Nato defence ministers in Brussels.
High-ranking members of the Libyan leader's inner circle were sent to Cairo, Brussels, Lisbon and Malta to approach government officials.
The Libyan government meanwhile offered a reward for the capture of rebel leader Mustafa Abdel Jalil, the ex-justice minister.
The amount was 500,000 Libyan dinars ($400,000; £250,000).