UPDATE 1-Sri Lanka president picks ally as chief justice
* Justice sworn in amid tight security
* Bandaranayake says still legitimate chief justice
* Lawyers protest appointment
* Supreme Court says removal of justice illegal
COLOMBO, Jan 15 (Reuters) - Sri Lankan President Mahinda Rajapaksa appointed a close ally as chief justice on Tuesday, two days after he controversially sacked the country's top judge for impeachment despite opposition from the Supreme Court.
Mohan Peiris, a former attorney general, was sworn in, Presidential spokesman Mohan Samaranayake said.
Around 100 special taskforce police officers were deployed at the Supreme Court as dozens of lawyers held candles in protest over the appointment outside the building in central Colombo.
The dismissal of Shirani Bandaranayake has threatened a constitutional crisis in the small island state which has been finding its feet slowly after a quarter century-long civil war ended in 2009.
Bandaranayake's removal from office on Sunday was illegal, the Supreme Court has ruled, prompting the United States and United Nations to voice concern.
Opposition lawmakers, religious leaders and lawyers have also expressed concern after parliament, controlled by Rajapaksa's party, voted on Friday to impeach Bandaranayake, the country's first female chief justice.
The clash between the government and judiciary has underlined the power wielded by Rajapaksa and his family in the island nation, where he has been president since 2005.
"Today marks the funeral of the independent judiciary," said Sunil Watagala, a member of Lawyers Collective, a judicial activist group, as other lawyers blew out candles to symbolise the start of a dark era in the court.
Lawyers Collective has urged all Supreme Court judges not to accept Peiris's appointment.
Police attempted to prevent Bandaranayake from talking to media at her official residence, which she left in the afternoon.
"My life is in danger," she told reporters sitting inside her vehicle before leaving.
In a separate statement she said she had suffered because she stood for an independent judiciary.
"I still am the duly appointed legitimate Chief Justice," it said.
"(But) since it now appears that there might be violence if I remain in my official residence or my chambers, I am compelled to move out."
Bandaranayake fell from favour with Rajapaksa after she ruled that the president's younger brother, Basil Rajapaksa, would need to seek further approvals for his proposal of a $614 million development budget.
Peiris, a 38-year veteran of the legal profession, has served as state counsel, attorney general and legal adviser to the Sri Lankan Cabinet of Ministers.
Political risk consultancy Eurasia Group said in a note that because of his well-known close ties to the Rajapaksa family, Peiris could face questions from the Supreme Court or Court of Appeals on the legality of any decision he makes.