British Airways passengers bound for Germany were stunned when their flight landed and the pilot told them, “Welcome to Edinburgh.”

The pilots of BA3271 were handed the wrong flight plans for the trip, and wound up in a destination 500 miles off course, the BBC reported.

Passengers thought the announcement was a joke.

“The pilot said he had no idea how it had happened. He said it had never happened before and that the crew was trying to work out what we could do,” 24-year-old passenger Sophie Cooke told the outlet.

The wrong flight plan was filed by Germany-based WDL Aviation, which ran the flight on behalf of British Airways, the airline said.

WDL said it was looking into how the “obviously unfortunate mix-up” happened.

The plane sat on the tarmac for two and a half hours while it was refueled and then took off for the correct destination of Dusseldorf.

“It became very frustrating,” said Cooke. “The toilets were blocked and they ran out of snacks. It was also really stuffy.”

Quipped passenger Son Tran on Twitter: “While an interesting concept, I don’t think anyone on board has signed up for this mystery travel lottery.”

With Post wires