Danny Boyle has confessed to feeling guilty about casting Leonardo DiCaprio in his hit film The Beach, instead of Ewan McGregor.

Danny and Ewan have worked together on a handful of projects, including Trainspotting and its forthcoming sequel, but they fell out years ago after the actor was snubbed for Leo.

Ewan was lined up for the role in the 2000 movie, an adaptation of Alex Garland’s novel of the same name.

Trainspotting 2 filmingEwan McGregor, Ewan Bremner and Danny Boyle (Jane Barlow/PA)

Speaking to Empire magazine, Danny said: “We weren’t particularly respectful towards [Ewan], way back in the day.

“But he’s always been very, very generous. So we met and talked and I said how sorry I was, the way we had treated him. And it rebuilt from there.”

Earlier this year Ewan spoke about the rift himself, admitting he felt “regret” over all the films they missed out on during their time apart.

Ewan McGregorEwan McGregor (Andrew Milligan/PA)

He told The Times: “It was almost nothing to do with The Beach. I mean, of course, it was all over The Beach and my understanding that I was playing the role.

“To discover that I wasn’t came as a bit of a shock. It wasn’t just not getting that role. It was [the way] it was handled that wasn’t very clever. I did knock me a little bit.”

Danny and Ewan first worked together in the director’s film Shallow Grave in 1994 and they also paired up for A Life Less Ordinary in 1997.

Leonardo DiCaprio Leonardo DiCaprio in 2000 (Michael Crabtree/PA)

Luckily for fans of the pair, they have put their difficulties behind them and are now gearing up for the release of the hotly-anticipated T2 Trainspotting sequel in January.

The movie brings together the original Trainspotting cast of Ewan, Robert Carlyle, Jonny Lee Miller and Ewan Bremner.