Lewis Hamilton has won the British Grand Prix at Silverstone five times

The future of the British Grand Prix has been secured for the next five years with a new agreement between Formula 1 and Silverstone.

This weekend's event was due to be the last after Silverstone ended its contract because it was too expensive.

But after two years of negotiations, Silverstone and F1 bosses signed a new deal until 2024 in London on Tuesday.

F1 chairman Chase Carey described the race at Silverstone as "an integral part" of the future of the sport.

Carey said: "We have always said that, if it is to have a long-term future, our sport must preserve its historic venues and Silverstone and Great Britain represent the cradle of this sport, its starting point back in 1950."

John Grant, chairman of Silverstone's owners, the British Racing Drivers' Club (BRDC), said: "Silverstone is one of the most iconic Grands Prix on the F1 calendar and with such a rich heritage it would have been disastrous for the sport and fans had we not managed to find a way forward."

Silverstone had been on the brink of signing a new contract last month only to pause when F1 informed the track of plans to hold a race in London in the next few years.

The BRDC had been concerned that another race in the UK would hit spectator numbers and make the British Grand Prix less financially viable.

But the track and F1 have found a way out of the impasse.

Silverstone managing director Stuart Pringle said: "We've been given sufficient comfort in the event that F1 can bring an additional race in the UK on to the calendar that it is additional, and the fears we had have been sufficiently addressed in the contract.

"We are not against trying to grow the fan base in the UK and if a second race helps achieve that, great.

"But we have taken a lot of commercial risk and we need to be protected.

"All the aims we set ourselves two years ago have been met to our satisfaction."

F1 owner Liberty Media pledged to protect the future of the sport's historic European races when it bought the sport in 2017.

However, Silverstone's future has continued to be a bone of contention, as it was for previous F1 boss Bernie Ecclestone for many years.

In 2017, Silverstone exercised a break clause in a contract that could have run until 2026 because it said the "escalator" clause in the deal, which saw the price rise by 5% each year, made it unaffordable.

Both Silverstone and F1 have always maintained that they wanted to keep the race on the calendar but it has taken two years to find a solution that satisfies both parties.

The announcement about Silverstone comes after F1 said earlier this year that it had agreed terms on a deal to secure the Italian Grand Prix at Monza, the oldest race on the calendar, until 2024.