Brazilian police foiled a bank heist this week that could have been the biggest robbery in the country's history.

They stopped 16 thieves from robbing the Bank of Brazil in Sao Paulo, one of the country's largest cities, after unearthing a 500m that the gang had dug from a nearby rental house to lead into the bank's main vault.

Sao Paulo state Public Safety Department said that they had been monitoring the gang for almost three months before they discovered the enormous secret tunnel, which reportedly cost more than $1.27m to build.

After they were arrested, the robbers told police that they had been planning to steal 1 billion reais (£240m) from the national bank.

It would have been the biggest bank robbery in Brazil's history if they had seen the heist through, according to local media.

The robbers dug the tunnel by hand, carrying sacks of soil down a 2m ladder from the rental house, according to newspaper El Globo.

The tunnel had been fitted out with electrical lights and reinforced with wooden beams, police said. They found a large supply of food, water, special clothing and digging tools in the house.

Police told the Associated Press that the leader of the gang was a 35-year-old woman who was implicated in the attempted robbery of a security van in Paraguay. The 16 suspects are being held in pretrial detention.

Twelve years ago, a group of Brazilian robbers managed to pull of a similar heist when they tunnelled into a bank vault in the city of Fortaleza and made off with $70m.

Brazil bank tunnel
Brazil bank tunnel
Police discovered a 500-meter-long tunnel which lead straight into the main vault of Bank of Brazil in Sao Paulo, Brazil