PINOLE -- Emergency crews spent more than three hours Friday night rescuing a 27-year-old man who got stuck in a 12-inch-wide storm drain pipe after entering a catch basin on a Pinole hillside in attempt to get warm.

The victim, a Richmond transient, was treated for hypothermia, dehydration and scrapes after rescuers safely sawed him out of the pipe just after midnight, Pinole Fire Battalion Chief Brian Lowry said.

The man's muffled cries for help prompted a passer-by to call Pinole police about 8:30 p.m. to the hillside next to the Best Buy store at 1490 Fitzgerald Drive. After about a half-hour walking the area, officers found the victim wedged feet-first, down a three-foot corrugated steel drain pipe, Lowry said. The pipe is attached to a five-foot-deep catch basin that descends downhill at a 40-degree angle.

Crews tried but could not physically pull the man out, so they summoned 28 personnel from Contra Costa County fire departments and Pinole public works.

Teams took turns digging and made a six-foot deep trench to uncover 12 linear feet of pipe, all the while passing the man oxygen and water. They lifted him out after sawing the pipe open, and then used a rescue basket and rope to move him down the hillside to an awaiting ambulance.

The man was unable to say why he went into the pipe or how long he was trapped in the pipe before the rescue started, Lowry said.

Contact Malaika Fraley at 925-234-1684. Follow her at Twitter.com/malaikafraley.