The airline said in a statement that it was seeking clearance from local authorities to transfer the passengers to a hotel until a replacement aircraft arrived from Singapore. It didn't say what caused the loss of cabin pressure. Airline officials couldn't immediately be reached for comment.

The airline said on its Facebook page that a noise was reported from one of the main deck doors on the plane's earlier flight to London. The door was inspected by engineers on the ground in London but nothing unusual was found and the plane was cleared for continued operation, it said.

Airbus said in a statement that "We confirm that the flight was diverted to Baku. We are following up on this issue and providing technical assistance to the airline."

Nathan Phelps, who works in Perth, was on board the flight and tweeted this photo of passengers wearing oxygen masks.