Fernando Alonso: Two-time F1 champion to race at Le Mans in 2018 & 2019
Fernando Alonso will race at the Le Mans 24 Hours in 2018 and 2019 as part of a deal that will see him contest all but one World Endurance Championship race for Toyota this season.
McLaren revealed the news, previously reported by BBC Sport in November, saying Alonso's Formula 1 commitments remained "their shared top priority".
He will miss October's WEC round at Fuji as it clashes with the US GP.
Alonso, 36, said he hoped to realise his ambition of winning Le Mans.
The two-time F1 champion has set himself the target of winning motorsport's so-called 'triple crown' of the Monaco Grand Prix, which he has won twice, Le Mans and the Indianapolis 500. Only Graham Hill has achieved the feat so far.
He competed at Indy in 2017 and was running competitively when his engine failed in the closing stages of the race.
Alonso said: "We tried for Indy last year, came close, but just missed out. This year, I have the chance, thanks to McLaren, to race for the win at Le Mans.
"It is a big challenge - much can go wrong - but I am ready, prepared and looking forward to the fight."
Alonso is committed to racing for Toyota throughout what is known as the 2018-19 'super-season' as long as the races do not clash with grands prix.
It begins with the Spa Six Hours on 5 May and includes both the 2018 and 2019 Le Mans races. This season is effectively a transition to a new WEC format where the championship begins in the summer and ends at Le Mans.
In 2018, only the Japanese WEC race clashes with a grand prix. At the end of the 2018-19 season, there are three races next year - at Sebring on 16/17 March, Spa in Belgium on 4 May and Le Mans on 15/16 June.
The 2019 F1 calendar will not be published until late this year but there are unlikely to be any clashes.
That means Alonso has at least two chances to win Le Mans with Toyota.
His McLaren contract is for one year with options to continue with the team beyond that.
"My deal to race in WEC was only made possible through the good understanding and strong relationship I have with McLaren, and I'm very happy that they listened and understood what this means to me," Alonso added.
"In no way will this challenge take away from my main target of Formula 1 with McLaren.
"In 2018, my aim is to be competitive at every grand prix, and I feel sure that we are closer to achieving that."
McLaren executive director Zak Brown said: "It's no secret that Fernando has wanted to contest the Le Mans 24 Hours. I think everybody within our organisation appreciates that a motivated, hungry and happy world-class driver such as Fernando is a formidable asset for any team in F1.
"Last year, we came to the joint decision to go racing with Fernando at the Indy 500 rather than at the Monaco Grand Prix. But we've always said that we would consider each opportunity on a case-by-case basis, and we both know that, in 2018, our core priority is success in Formula 1.
"Like Fernando, at McLaren we're racers at heart, and our team is built on a brave heritage of competing and succeeding in different forms of the sport.
"Equally important is the confidence that nothing detracts from our number one goal of Formula 1.
"After proper evaluation, we are satisfied that this campaign does not do that, and that McLaren's best interests prevail."