It was found that some of those involved in the “industrial scale” enterprise had been sleeping on mattresses in the loft.

There was a hole in a wall leading to the loft and it was there the two men had been hiding when the premises were raided.

The plants had a potential yield of cannabis with a street value of up to £1.7m a crop and there could have been four crops a year.

The court heard that Pham, also 18, admitted working there for three weeks and Nhan said he had set up the growing equipment in July.

Officers estimated the farm inside an unused pub in Rice Lane, Walton contained more than 2,000 cannabis plants, making it one of the largest ever uncovered in Merseyside.

Detective Inspector Mark Kameen, said: “This is just one example of the successes the force has had in recent months in uncovering cannabis farms and bringing offenders to justice.

“The public have been a massive help in telling us what they know and in return we have vowed to act on that information and, as we have today, take action against the criminals who are profiting from these farms.

“Cannabis is not a harmless drug. It is hugely profitable to grow and sell it and we know that organised crime groups set up and control these factories, often in the very heart of local communities.

“The knock-on effects can be devastating for decent, law-abiding people who live there and we would continue to urge anyone with any information about cannabis production in their area to get in contact so we can continue to take action.”