SAN BERNARDINO, Calif. -- A 2-year-old boy and his 6-year-old sister were killed in an apartment fire that also left their father gravely injured, while their mother was in the hospital to give birth to a third child, authorities said.

The family had been living illegally in the San Bernardino apartment and were kicked out at least once before returning, fire officials said.

The man was taken to a hospital in critical condition Thursday with severe smoke inhalation and burns over most of his body, fire Battalion Chief Michael Bilheimer said.

Get Breaking News Delivered to Your Inbox

CBS Los Angeles reports the girl has been identified as Candra Leetch.

The children's mother had gone into labor and was taken to a hospital before the fire broke out. She had not given birth by Thursday afternoon and authorities were waiting to tell her about the tragedy, Bilheimer said.

"She's bringing one into this world and she lost two of them, so it's just really bad for them," said Ernie Nunez, a family friend who went to the scene. "Just feels really bad for the family."

The fire was reported shortly after 3 a.m. Thursday in an apartment built over a garage. A neighbor walking a dog spotted smoke spewing from the unit, which had no smoke detector, Bilheimer said.

The father could be heard shouting inside the burning, smoke-filled home, Nunez said.

"He was yelling for help: 'Help my kids,'" Nunez told CBS Los Angeles.

Firefighters doused the flames within 20 minutes. The children were unconscious and not breathing when they were discovered huddled together behind the living room couch, Bilheimer said.

Despite efforts to revive them, they were pronounced dead at a hospital.

The father was found on the floor near the front door.

Crews responded to the blaze after a neighbor walking a dog spotted smoke spewing from the upstairs unit.

The cause of the fire remained under investigation but investigators don't believe it was deliberately set, Bilheimer said.

The family was living illegally at the property in a 500-square-foot unit that was one of three units on a foreclosed property.

The apartment had blocked exits and was illegally obtaining its electricity, gas and water from other units, police and fire officials said at an afternoon news conference.

The city had issued more than $100,000 in fines because of code violations at the property since 2009, authorities said.

"This property should not have been occupied," City Attorney Gary Saenz said.