Central Bureau of Investigation (CBI) Special Judge JPS Malik pronounced the sentence.
The CBI had sought death penalty for the convicted policemen saying they behaved in a "predatory manner", which falls under the act of "rarest of rare".
On Sunday, asking for harsh punishment to the guilty policemen, CBI counsel and senior public prosecutor Brajesh Kumar prosecutor said: "They (police) were the protectors of law but they behaved in a predatory manner. They should have given protection to the victim, but they killed him in a fake encounter (staged shootout)."
He said harsh punishment to the guilty policemen will send a strong message, and "no public person in future can even think of doing such crimes".
Friday, the court convicted 18 policemen involved in the case that rocked the hill state in 2009.
The 18 convicted policemen are then inspector Santosh Jaiswal, sub-inspectors Gopal Dutt Bhatt, Rajesh Bisht, Neeraj Kumar, Nitin Chauhan and Chandra Mohan, constables Ajit Singh, Satbir Singh, Sunil Saini, Chander Pal, Saurabh Nautiyal, Nagendra Nath, Vikas Chandra Baluni, Sanjay Rawat, Mohan Singh Rana, Inder Bhan Singh and Manoj Kumar and Jaspal Singh Gossain.
Of them, 17 accused were convicted for murder, for conspiring to murder and one was convicted for framing incorrect record.
Gossain, the head operator at the city control room, was convicted under section 218 of the IPC (public servant framing incorrect record).
He was left off on Friday after he furnished a bail bond as he was only convicted for fabrication of evidence and had already undergone what could have been the maximum jail term for the offence.
Meanwhile, the court asked police to provide "high security" to the policemen during transit between jail and court after it was informed by the Tis Hazari lock-up in-charge that there may be trouble.
The lock-up in-charge said in an application that there was apprehension the convicts may harm each other after their conviction. He claimed it was heard the convicts were blaming each other for the outcome of the case.
The policemen were arrested after evidence showed that Ranbir, a resident of Ghaziabad, was gunned down in cold blood by the Uttarakhand Police. Following the staged shootout, the police claimed to have caught Ranbir and his companions on Mohini Road where they were allegedly "trying to commit some crime" July 3, 2009.
The trial was transferred from Dehradun to Delhi on the orders of the Supreme Court on a plea by Ranbir's father Ravindra Singh.
(With IANS inputs)