Two California men pleaded no contest Tuesday to 36 counts of involuntary manslaughter in a deadly fire at a dilapidated Oakland warehouse during an unpermitted concert.

Under the terms of the plea agreement, Derick Almena could be sentenced to nine years in prison and Max Harris could receive a six-year sentence. Formal sentencing is set to take place during a two-day hearing that begins Aug. 9.

With good behavior, both men are expected to serve only half their sentences. They have been in jail for a year.

Thirty-six people were killed on Dec. 2, 2016, after the fire broke out at the so-called Ghost Ship warehouse, which had been converted into an artist collective that included dwelling units. The victims, most of them in their 20s and 30s, were caught in a space that prosecutors described as a "death trap" with few exits, rickety stairs and dark and dangerous passageways.

Investigators said Almena, 48, rented the warehouse and illegally converted it into an entertainment venue and residences while Harris, 28, helped him collect rent and schedule concerts like the one taking place the night of the blaze.

Almena lived in the warehouse with his wife and three children. The family was staying in a nearby hotel on the night of the fire. Harris also lived in the warehouse and escaped the fire unharmed.

During Tuesday's hearing, the men said no contest as each victim's name was read. It was an emotional process that took 30 minutes and saw family members and friends cry quietly when their loved ones were named.

Relatives of the victims who were in court Tuesday were split about the plea deal. Some said they were pleased Almena and Harris accepted their roles in the tragedy, while others were angry that the men weren't given longer sentences and that they would serve time in county jail as opposed to state prison.

"That's 36 lives, you know," David Gregory, the father of 20-year-old victim Michela Gregory, told The Associated Press. "We wanted fair justice, and we didn't get it."

Almena's attorney Tony Serra said his client agreed to the plea bargain to alleviate "the pain and suffering of all parties."

Serra previously said a plea deal would spare the victims' families from testifying at a trial where photos of burned bodies and other emotionally fraught evidence would be shown.

Bureau of Alcohol, Tobacco and Firearms investigators said they could not determine the cause of the blaze.

A civil case brought by the victims' families against several defendants -- including Pacific Gas & Electric, the City of Oakland, and the warehouse owners -- is pending.

Fox News' Claudia Cowan in San Francisco and The Associated Press contributed to this report.