Someone probably "inappropriately accessed" a gas line before an explosion and fire that rocked a row of Manhattan tenements, injuring 22 people, four of them critically, and left two persons unaccounted for, Mayor Bill de Blasio said Friday.

The mayor said the owner of a sushi restaurant in the building at 121 Second Ave. smelled gas just 15 minutes before the explosion, but called the landlord instead of authorities.

"The first call has to go to 911 or Con Ed," de Blasio said at an afternoon news conference after touring the site in Lower Manhattan in the morning.

"You rarely see a scene of such devastation in the middle of a city like this," the mayor said.

He said investigators are working on the theory that someone "inappropriately accessed" and gas line in the basement, but he refused to say what prompted that suspicion. "There is some X Factor we don't know yet we have to find," he said.

The mayor said six firefighters were among the injured, but none of the injuries were life-threatening.

The explosion shook the block where employees of a private contractor were adding a new plumbing and gas system to an existing one inside a sushi restaurant, authorities said.

The explosion caused the collapse of three five-story buildings and damage to a fourth, which was seven stories tall, the Fire Department said.

The mayor and other officials walked through the tangled mounds of debris Friday morning as a half dozen pockets of smoke or steam rose from the rubble.

Joseph Esposito, head of the city's Office of Emergency Management, told reporters after the mayor left that it was too early to say exactly what had happened, and workers could not begin examining the interior until the fire was out.

Asked if there was any chance of survivors being found on the site, Esposito said: "I would doubt that very seriously."

Fire officials said Con Edison shut off the final gas valve serving the area about 11 a.m. Friday. They said there was no reason to fear a further collapse.

Firefighters spent the night hosing down the smoldering scene, and about 50 firefighters were still deployed there in the morning. They had used water from high-pressure hoses to knock down leftover facades.

Con Edison released a statement Thursday night saying its personnel had been at the building to "evaluate work the building plumber was doing inside 121 2nd Ave. in connection with a gas service upgrade. The work failed our inspection for several reasons, including insufficient spacing for the installation of the meter in the basement.

"We had no reports of gas odors in the area before the fire and explosion," the statement continued. "A survey conducted yesterday [Wednesday] of the gas mains on the block found no leaks. We continue to work with all agencies on the investigation into the cause, and we are praying for the recovery of all the injured."

The boom was heard about 3:15 p.m. Thursday. A Con Ed inspection at 2 p.m. gave failing marks to the new work, preventing any gas from flowing through the new lines, authorities said.

Tobarka Hassan, a waiter working at a nearby Indian restaurant, said he rushed out at the sound of a huge explosion and spotted a woman on the third floor of one building fleeing to safety using the fire escape of an adjacent building.

"Everything was falling down," Hassan said. "Fire was coming from the basement to the top of the building. I felt the heat from here, at least half a block away."

The first of 250 firefighters arrived three minutes after the first 911 call came at 3:17 p.m., said FDNY Commissioner Dan Nigro: "They certainly didn't expect to see the explosion blow the front of 121 across the street."

Flames consumed the upper floors of the five-story buildings at No. 121 and 123.

Then, just before 4 p.m., as firefighters had feared, No. 123 crumbled. A huge gray plume of smoke and dust mushroomed up, but no firefighters were hurt. No. 121 also partially collapsed.

The inferno spread to adjacent buildings, No. 119 and 125 and later, the FDNY said, 119 also partially collapsed.

Fire officials said Friday morning that 123 had completely collapsed, 119 and 121 were so badly damaged they will have to be demolished before debris removal can begin, and 125, seven stories tall, was damaged.

Of the four critically injured, two had burns to their airways and one was knocked unconscious, Nigro said.

City officials said they did not have any reports so far of people smelling gas just before the blast.

Con Edison crews shut off gas to the area, and Gov. Andrew M. Cuomo said the state Department of Public Service was on the scene to monitor the utility's performance.

He also said the state agency will conduct a "full investigation" to determine the cause of the explosion.

"We will continue to monitor this tragedy and do whatever is needed to support the ongoing response and recovery in the days ahead," he said in a statement.

The Health Department said air quality at the site had returned to "typical levels" Friday morning. There had been "elevated particulate levels" Thursday, but they did not pose a significant risk to the public, the department said.

Red Cross officials set up a shelter at a nearby school, where Anna Ramotowska, 26, and her roommate, Lucie Bauermeister, showed up.

Ramotowska said after lunch she had returned to their third-floor apartment at 129 Second Ave. when they felt the blast.

"It felt like an earthquake," Ramotowska said.

They grabbed their dog, their phones and wallets, and ran out, where they saw glass all around the street and people, young and old, trying to escape down a mangled fire escape.

The roommates said they will stay with friends.

"We want to know what is going on," Ramotowska said, "and when we can go back."

About 79 adults and one child had registered for services at a Red Cross disaster center at PS 63, said Josh Lockwood, regional CEO for the American Red Cross Greater New York region.

"People are stunned. Most people are in a state of shock. They're processing the day's events. They're grieving over the loss of a home. They might have a pet that's missing," Lockwood said.

Officials said 30 requested and were given overnight accommodations. The reception center was relocated Friday morning to the Tompkins Square library branch at 331 E. 10th St.

With William Murphy