A water leak from what appeared to be a broken city main caused flooding outside student dorms at San Jose State University on Sunday evening, according to university police.

The leak, which continued gushing for about three and a half hours, started about 4:15 p.m. on the east side of the downtown San Jose campus near student housing complexes, SJSU police said.

The water pooled to ankle depth in some places until crews got it turned off by about 8 p.m. Some students returning to campus from their weekend were taken aback.

"I definitely was not expecting to come back to this," freshman Caspian Woodward said. "I wasn't here when it blew, but it's a mess."

Campus police stopped students from crossing the flowing water as they tried to get back to their dorms.

"It's crazy," freshman Shivani Yadav said. "It's pretty high-up water too."

The break happened on a city-owned water main, right between two of the campuses newest and largest dorms, raising concerns about getting to classes in the morning.

"This is my main way to go, so it's going to be worse to try to get there now," freshman Emma Chatelain said. "I'm just hoping they shut it off soon, because this is going to be a lot of damage."

The flooding also was approaching a construction site where a new acquatics complex was being built.

It was not clear what caused the leak. A campus spokesperson said workers were mopping up minimal water inside one of the buildings, and the incident would not affect classes Monday morning.

The water company will be at the scene until at least late Monday morning repairing the broken line, officials said.

NBC Bay Area's Thom Jensen contributed to this report.