Lockley has told police he woke from a sleep during the flight in a confused state and banged on he cockpit door thinking it was the toilet.

He also denies being drunk, and told police he had taken only Panadol, Voltaren and consumed Coca-Cola before the flight.

Suryambodo Asmoro, Bali Police special crime director, told reporters Lockley was allowed to leave hospital on Sunday and was questioned by aviation officials.

Security ... Indonesian Police secure the room of the Police Hospital where Australian Matt Lockley was taken.Source: Supplied

“Regarding the legal process, it will be conducted in Australia because what he did in that plane was within a plane registered in Australia,” he said.

In hospital, Lockley underwent drug and alcohol testing, the results of which have not been returned.

He was also allowed to recuperate from what police described as “exhaustion”.

They say Lockley came to Bali looking for his Indonesian wife, whom he hasn’t seen in weeks, and was in a state of stress.

Mr Asmoro says he does not know when Lockley will be deported. Indonesian aviation officials are also looking into the circumstances surrounding the hijack alert.

Visitor ... a friend of Matt Lockley arrives at the Police Hospital in Bali.Source: Supplied

Virgin Australia today released a statement saying international protocols require the crew to send an “unlawful interference code” when an individual attempts to enter the cockpit unlawfully.

It is entered to notify Air Traffic Control of the perceived threat, Virgin says.

“This is used by all airlines internationally to ensure the safety of passengers, crew and the aircraft,” the statement said. “The captain and crew ensured the highest level of safety was maintained on flight VA41 and followed standard operating procedures.” Following the aircraft’s landing on Friday, airport authorities said they received no communication from the plane for 30 minutes, forcing airforce officers to approach with caution.

They only boarded the plane after making visual contact, and found Lockley already detained, unarmed and police say he did not resist arrest.

However Virgin says its captain was in regular contact ahead of the landing.

“The captain was then in regular communication with Air Traffic Control in line with correct protocols to keep them informed of the status of the disturbance prior to landing,” its statement said. Lockley has been visited by Australian consular staff and friends.

Friends of Lockely have visited him in the police hospital where he was being held, and said he seemed “confused and nervous”.

One of them, a Balinese man who said his name was Wayan, said he was surprised when he heard about the incident on the Virgin flight.

He said he had been called by police on Friday afternoon to come and help calm Lockley down after a dramatic arrest at gunpoint.

“Police told me to calm him. But I can’t go that afternoon, as I still working. I said that I will come once I finished,” Wayan said.

Lockley told police he was stressed over not being to make contact with his Indonesian wife for several weeks before his flight on Friday.

The Queensland plumber was described on Friday as drunk by airline and Indonesian authorities, but yesterday insisted he had only consumed soft drinks before the Brisbane to Bali flight and taken some painkillers.

Bali police spokesman Adj. Senior Commissioner Hery Wiyanto said yesterday police had inquired whether Lockley, 27, had any history of mental illness but they were told he did not.

Comm Wiyanto said that Lockley had told them he had meant to knock on the toilet door but instead had been hammering on the cockpit door. This caused the pilot and crew to report an emergency and authorities in Bali were then put on a hijack alert.

Full security was swung into action and when the flight, from Brisbane to Bali landed at Denpasar airport, it was surrounded by heavily armed officers who bundled Lockley off the plane at gunpoint.

Police said yesterday that Lockley’s father lives in Bali, in a villa in Canggu and that Lockley’s wife was from Bandung, in West Java, Indonesia.

They said that Lockley told them he was stressed about not being able to contact his wife for the past two weeks after she had returned to Indonesia from Australia.

Comm Wiyanto said Lockley told them that once he got on to the plane, he fell asleep in his seat (30A), after having taken some painkillers and drinking two soft drinks.

“He slept for three hours. He woke up when the stewardess offered food. Once he woke up, he went to the toilet. When he went out from toilet, he felt that someone was following him. He then sat down again in his seat. But then he went to the toilet again. As he panicked, he knocked on the cockpit door, “ Comm Wiyanto said.

News.com.au's Privacy Policy includes important information about our collection, use and disclosure of your personal information (including to provide you with targeted content and advertising based on your online activities). It explains that if you do not provide us with information we have requested from you, we may not be able to provide you with the goods and services you require. It also explains how you can access or seek correction of your personal information, how you can complain about a breach of the Australian Privacy Principles and how we will deal with a complaint of that nature.

A NOTE ABOUT RELEVANT ADVERTISING: We collect information about the content (including ads) you use across this site and use it to make both advertising and content more relevant to you on our network and other sites.