Spanish police on Thursday rescued six workers who were found trapped and gasping for air in an illegal tobacco factory hidden beneath a mountain village in southern Spain.

The workers, a mix of Ukrainian and Lithuanian nationals, were rescued after police arrested the suspected masterminds of the elaborate operation in Monda, near Malaga.

Spanish civil guards stand in an illegal underground tobacco factory during a police raid in Monda, near Malaga, in southern Spain. (Reuters)

Spain’s Interior Ministry said Thursday that the underground factory, which could produce as much as 3,500 cigarettes in an hour, was hidden in a maze of tunnels and was only accessible through a secret trapdoor entrance.

The suspects’ arrest left the workers with no one to replenish the generator that provided them oxygen, Reuters reported. Police discovered them after hearing them bang on a soundproof trapdoor to get their attention.

“If the officials had not found the clandestine factory in time, the lack of oxygen would have soon made … the underground conditions incompatible with the survival of the workers who were there,” police said.

ZIMBABWE GOLD MINE COLLAPSE LEAVES AT LEAST 2 DEAD, 20 TRAPPED IN ILLEGAL OPERATION: STATE MEDIA

According to police documents, the factory also housed an indoor cannabis plantation and machinery for the plastification of cigarette packs.

Spanish police, working with Interpol, confiscated 153,000 packs of cigarettes, more than 17 tons of rolling tobacco, 44 lbs. of hashish and nearly 320 pounds of marijuana.

The suspected masterminds, who are all British nationals, are being held in custody.

CLICK HERE TO GET THE FOX NEWS APP

Regarding the six workers, a police spokesman said a judge “will decide their degree of responsibility.”