Firefighters had to rescue a drunk man who was stuck between a wall and a fence on Thursday morning.

A drunk man wedged between a wall and a fence was rescued by firefighters in Dunedin.

The fire service was called to assist the police on Great King St on Thursday at 12.30am following reports of a trapped man.

Firefighters spent 20 minutes trying to free the "young man", who was delivered into the care of police, a fire service spokesman said.

Dunedin senior station officer Mark Leonard said firefighters used a sewer knot, which is used to raise a patient vertically, to free the man

Senior Sergeant Craig Brown said the intoxicated man was "happy to be freed".

It was unclear how the man became stuck.