About 40 hikers, both adults and children, had to be rescued Saturday evening after they were trapped in Bear Canyon by rushing water from rains earlier in the day.

Groups of hikers were stranded in different parts of the canyon after water began rushing down through the Catalina Mountains northeast of Tucson, said Deputy Tom Peine, spokesman for the Pima County Sheriff's Department.

Rescuers on the ground monitored gauges to determine whether the water was receding or rising, and decide the best way to rescue the hikers. A Department of Public Safety helicopter assessed the situation from the air.

The first group of hikers was led out of the canyon just after 5 p.m., Peine said. Deputies used swift-water rescue techniques - roping together hikers and flotation devices - to walk some of them through the water. Others were flown out of the canyon by helicopter.

A Sun Tran bus waited near the Bear Canyon trailhead to drive hikers back to their vehicles in the Sabino Canyon parking lot.

"The hikers in the Bear Canyon area did not take into account that the weather conditions earlier in the day might have a delayed effect," Peine said.

Most of those stranded had been rescued by nightfall, but just after 6:30 p.m. searchers hiked back into the canyon to bring out the last 10 or so who were trapped, Peine said.