A man who started a fire in the toilet of a plane carrying more than 200 people has had his prison sentence more than doubled at the court of appeal.

The Monarch Airbus was 10,700 metres (33,000ft) in the air and 100 miles (160km) from the Egyptian coast when the captain was told the crew were having difficulty extinguishing the blaze in a waste paper bin.

He issued a mayday call and was set to carry out an emergency landing on the flight from Birmingham to Sharm el-Sheikh in August 2015.

By “the most extraordinary stroke of good fortune”, said Lady Justice Sharp on Thursday, there was a passenger who worked for a fire and rescue service who helped the crew deal with the blaze so the plane could complete its journey safely.

A smoke detector first went off an hour into the flight and a fire – in a different toilet – was put out by the crew.

The second incident, a few hours later, occurred after the captain had issued a strongly worded warning about the “moronic” conduct of smoking on an aircraft.

In January at Birmingham crown court, John Cox, 46, pleaded guilty to an offence of arson being reckless as to whether life was endangered and was later sentenced to four years and six months in jail.

Cox, of Kidderminster, had been drinking before and during the flight, and was rude, abusive and very aggressive when challenged by passengers and crew.

He was detained by the Egyptian authorities when the plane landed and arrested on his return to the UK.

The appeal judges agreed with the attorney general that the sentence imposed was unduly lenient and increased it to nine years and six months.

They heard that the offence was out of character for Cox, who was a hard-working family man coping with his mother’s death and his marriage breaking up.

Sharp, sitting with Mr Justice Warby and Mrs Justice Cheema-Grubb, said the victim impact statements painted a “frightening and compelling” picture of the distress suffered by the passengers and crew.

The captain, who had flown for Monarch for 20 years, said he had never experienced an incident with so much potential danger, she added.

“The level of culpability and potential for harm is at the highest level. To throw a cigarette butt into a wastepaper bin without ensuring it is extinguished would show a high degree of recklessness. On an aircraft at 33,000ft, the conduct comes perilously close to deliberate fire-setting.”

It was an exceptional case and called for a deterrent sentence, said the judge in London.