A drug dealer who posed as a cop to raid an associate's house has been sentenced to jail on Tuesday by Victoria's Supreme Court. He had beaten up two men within inches of their death with a hammer.

Daniel Thomas, 36, pleaded guilty to aggravated burglary and multiple other charges and was sentenced to eleven and a half years of jail time by the court. Thomas has been in pre-sentence detention for 1126 days already.

On July 25, 2016, Thomas and a co-accused stormed into the house of an associate dressed up as Victoria Police screaming and asking for drugs.

"This is a police raid. Get on the floor face down. Where are your drugs?" they yelled as they stormed into the unlocked Lilydale home, The Age reported.

The victims mistook it for a real raid and handed over their stash of ice and cannabis. Thomas, however, felt that they had not given him everything, and beat one of them with a hammer till he passed out. He then threatened the other man to turn over the remaining drugs.

"We've killed your mate. Now tell us where the drugs are," Thomas told him, making the druggie realize he was not dealing with cops. The second victim was then hit in the head and had his buttocks spread out and checked for drugs.

When the real police arrived, they saw blood-stained walls and floors. They began taking photographs for evidence, believing both victims to be dead. However, the cops realized their mistake when one of the injured men moved.

When the police tracked down a drug-riddled Thomas, he pulled out his knife and asked them to stay away, before having a go at one of the officers. He was nabbed using tasers and capsicum sprays.

At one point Thomas claimed that he attacked the men because one of them had supposedly done something to a girlfriend of his. But this claim was rejected by Judge Paul Coghlan.

"The use of police uniforms, the demand for drugs and money repeated on a number of occasions simply put a lie to that explanation," Coghlan said.

Thomas will now have to spend at least 9 years in jail before being eligible for parole.

Australia police raid
Australian Federal Police officers (right) exit a house as four people were arrested over the terror-linked murder of a police employee after coordinated raids by more than 200 officers on properties across Sydney on Oct. 7, 2015. Those seized in the dawn operation were aged between 16 and 22 and face questioning over the Oct. 2 killing of Curtis Cheng outside New South Wales state police headquarters in the city's west. Getty Images/William West/AFP