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.
Members of the three-man team were beaten with fists, knees and rifles, hooded and subjected to mock executions by Libyan troops and secret police.
The three were detained on Monday and held for 21 hours, but have now flown out of Libya.
The UN Human Rights Commissioner says their treatment may amount to torture.
"For them to be targeted, detained and treated with such cruelty, which could amount to torture, is completely unacceptable and in serious violation of international law," said High Commissioner Navi Pillay in a news release.
"If an international television crew can be subjected to this type of treatment," she said, "it makes me extremely concerned about the treatment that is most likely being meted out to Libyan opponents of the regime who have fallen into the hands of the security services."
The BBC said in a statement that it strongly condemned the "abusive treatment" of its journalists.
"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."
'Gun against neck'
The BBC Arabic Service 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 to reach besieged Zawiya.
Over the past four days, government artillery and tanks have pounded the city, 50km (30 miles) from Tripoli, in a bid to wrest it from rebel control.
The BBC employees 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 plainclothes 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 - appears 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.
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.