That’s when the defendants illegally tapped a gas line, prosecutors said. Two months later, after receiving complaints about the smell of gas, utility workers found that a line from a ground-floor sushi restaurant in the building had been siphoned to provide gas to the apartments.

Con Edison turned the gas off to that building for nine days and restored service after the tapping apparatus was removed. But prosecutors said the defendants had rigged a series of pipes and valves at 119 Second Avenue, a neighboring building that was also owned by Ms. Hrynenko, to provide gas to the apartments.

The illegal system was in the basement and behind locked doors.

Con Edison inspectors found fault with a proposed meter location in the basement on the day of the explosion.

During that inspection, Mr. Kukic and Mr. Ioannidis turned off the secret gas line. Afterward, prosecutors said, Mr. Kukic and Ms. Hrynenko’s son, Michael Hrynenko Jr., turned the gas back on, but did not close several valves in the basement of 121 Second Avenue that had been opened for pressure tests by Con Edison.

Ms. Hrynenko was later alerted to the smell of gas by the restaurant manager. Her son and Mr. Kukic investigated the matter. The two men were seen on surveillance video running out of the building without notifying patrons or calling 911. They ran into a basement entrance on East 7th Street where the illegal gas system was set up.

Minutes later, the explosion shook the neighborhood, sparking a monstrous blaze that eventually leveled three buildings on Second Avenue. Two people inside the sushi restaurant — Moises Ismael Locón Yac, 27, a busboy, and Nicholas Figueroa , 23, who had been on a lunch date — were killed.