* Navi Pillay urges both sides to protect civilians
* Her office sees pattern in attacks by Assad forces
* Increasing allegations of executions, torture by opposition (Adds details)
By Stephanie Nebehay
GENEVA, July 27 (Reuters) - U.N. rights chief Navi Pillay urged both Syrian government forces and rebels on Friday to spare civilians in Aleppo, voicing deep concern at the "likelihood of an imminent major confrontation" in the city reminiscent of other deadly assaults.
A "discernable pattern" had emerged as President Bashar al-Assad's forces attempt - using intense shelling, tank fire and door-to-door searches - to clear areas of Syria's biggest urban centres they say are occupied by insurgents, she said.
"All this, taken along with the reported build-up of forces in and around Aleppo, bodes ill for the people of that city," Pillay said, adding that such attacks were also continuing in two other major cities, Homs and Deir al-Zor.
From the Baba Amro enclave of Homs last February, to Douma and Tremseh and Damascus in recent weeks, government forces have used heavy weapons to bomb an area, move in to remove rebels and leave behind security forces and snipers to prevent their return, a U.N. human rights official in Geneva told Reuters.
"An area will be identified as being opposition-controlled or full of opposition supporters, and the government will surround it and shell it with different kinds of heavy weapons and artillery, including the increased use of helicopter gunships in Aleppo and Damascus," the U.N. rights official said.
Referring to a massacre of up to 200 people in mid-July in Tremeh in central Hama, the official said: "In Tremseh, they would do house-to-house searches and ask the women where are the men? When they found some they would look at their identity cards and the man would be executed or detained or left alone."
Witnesses have said that government forces sometimes burn or take away the bodies of those executed in raids. "Or they would take detainees to the air force intelligence or military intelligence facilities," the U.N. official said.
Such counter-insurgency operations continue on the Old City of Homs, where an enclave of rebels remain, the official added.
Pillay cited unconfirmed reports of atrocities, including executions and shooting of civilians by snipers during recent fighting in the Syrian capital Damascus.
Her office had also been receiving an increasing number of reports of opposition fighters torturing or executing prisoners.
"We're told by some commanders or Free Syrian Army leaders that they have what they call prisoners of war," the U.N. human rights official said, speaking on condition of anonymity.
"We've heard from various sources that they do abduct or kidnap some high-level army officials or police and attempt to get a ransom," the official said.
The U.N. human rights office had received allegations about rebel forces submitting captured Syrian soldiers and police to a makeshift proceeding "where a sentence is passed, the death sentence in some cases," the official added.
"But we do not have reports of mass killings of civilians by opposition forces."
Pillay, a former U.N. war crimes judge, said that murder or a "wilful" killing, whether committed by government or opposition forces, may constitute crimes against humanity or war crimes. Torture is also prohibited under all circumstances.
Crimes against humanity and war crimes continue to be committed in Syria, she said, adding: "Those who are committing them should not believe that they will escape justice."
She also voiced concern at reports that unarmed prisoners had been killed in the central prisons of Aleppo and Homs during uprisings in the past week, in violation of international law.
Pillay called for an investigation by independent experts into the incidents, echoing an appeal by Human Rights Watch.
The New York-based group on Friday quoted "Samir", an inmate in Homs central prison, as saying that after a prisoner riot on July 21, government forces surrounded the facility and fired live rounds and teargas, killing at least seven inmates. (Reporting by Stephanie Nebehay; Editing by Mark Heinrich and Andrew Heavens)