Dozens people in Brooklyn were evacuated from their homes early Thursday morning due to a water main break that sent a geyser of water nearly 40 feet into the air.

Water gushed out of the main on Pacific St. near Albany Ave. in Crown Heights, affecting two residential buildings.

The city fire department said about 50 people were forced out of their homes when the main burst around 4:30 a.m.

"I thought I was dreaming at first, but, you know, I got focused, and he told me what was going on, so I kind of grabbed what I could grab and took off," said one resident in the area.

Crews from multiple city agencies worked for more than three hours to get the gusher from the 44-year-old water main under control.

Both buildings will be fully inspected for any damage.

Both streets were closed to traffic as crews made repairs.

City buildings department officials said tenants are now allowed back inside, but inspectors did issue a partial vacate order to 1526 Pacific St. after discovering two illegal apartments in the cellar.

The gushing water and debris also damaged several cars that were parked on Pacific St. Those vehicles had to be towed.

"We're going to help them fill out some forms with the comptroller's office so they can so they can get reimbursed for anything that might've suffered," said Tasos Georgelis, the deputy commissioner of water and sewer operations for the Department of Environmental Protection (DEP).

The DEP said the cause of the water main break is under investigation.