Nearly a dozen immigrant workers living in squalid conditions were freed Tuesday from a forced labor ring in Hayward, authorities said.

The victims were allegedly exploited to work at construction projects around the Bay Area and lived in an industrial building without running water that was locked from the outside at night.

At least seven people were freed from the building. The others were rescued from a nearby house, officials said.

Job Torres Hernandez of Hayward, the building’s owner, was indicted last week on charges that he harbored undocumented immigrants for commercial advantage, said the office of U.S. Attorney Brian Stretch. The indictment was unsealed Tuesday, shortly after Hernandez’s arrest.

The 37-year-old allegedly had at least five people concealed on his property since mid-2015.

Hernandez was scheduled to appear before Magistrate Judge Donna Ryu on Wednesday morning at the U.S. District Court in Oakland. He faces up to 10 years in prison and a fine of $250,000 if convicted.

Photo: Jacom Stephens / Getty Image

Lizzie Johnson is a San Francisco Chronicle staff writer. Email: ljohnson@sfchronicle.com Twitter: @LizzieJohnsonnn