Germany has approved a law that bans fracking after years of dispute over the controversial technology which releases oil and commercial gas trapped deep underground.
The law does not cover conventional drilling for oil and gas, so state governments are given the right to decide on these individual cases.
Hydraulic fracturing, known as fracking, which involves blasting a mixture of sand, water and chemicals underground to release shale oil and gas, will be banned entirely however.
A few scientific or non-commercial projects will be allowed to continue though, as long as they meet conditions specified by the legislation.
Up until now fracking has been largely unregulated in Germany and the current government has been working hard over the past months to draw up new rules.
An initial draft was put forward in April 2015 but was quickly scrapped due to strongly divided opinions on the subject.
The government has revived the proposal at the last minute however, after companies said they were tired of waiting for a legal framework and would push ahead with fracking anyway.
Many in the German population are suspicious of fracking and are afraid that it will have a large negative impact on the environment and on drinking water resources.
The fracking industry has run an intense campaign calling for the option to be left open for use.
Gas production companies including Wintershall and Exxon Mobil had originally agreed to a five-year halt to their extraction projects but eventually lost patience with the authorities.
The Green party of Germany has accused the government of rushing through the vote, using the British EU referendum and the Euro 2016 football championship as cover to sneak through a text that is too lax.