By Chris Nusatya and Morag MacKinnon

JAKARTA/PERTH (Reuters) - An Australian passenger mistook the cockpit door for the toilet, triggering Friday's hijack scare on a Virgin Australia flight from Brisbane to the Indonesian holiday island of Bali, police said.

Matt Lockley told Bali police after his arrest that he banged on what he thought was the toilet door for a last-minute bathroom break before the Boeing 737-800 aircraft landed.

The door was actually the cockpit door and the pilot, Neil Thomas Cooper, responded by alerting Indonesian traffic controllers of a possible hijacking. Crew members then seized Lockley and handcuffed him.

A spokeswoman for Virgin Australia said Lockley was not handcuffed on board, but was directed by the crew back to a seat in the rear of the plane.

"The flight was about to land and (Lockley) was sleeping. The flight attendant woke him up and he went to the toilet. At the time, he thought the cockpit door was the toilet door," Heri Wiyanto, Bali police spokesman, told Reuters.

Virgin Australia said the 137 passengers and seven crew on board were never in any danger during the flight.

"We can confirm there was a disruptive passenger on board and the pilot notified authorities in advance of landing, as per standard operating procedures," said Virgin spokeswoman Jacqui Abbott.

After taking blood samples from Lockley, police said the Australian had taken several painkillers, including four Panadol and two Voltaren pills. Police initially had said Lockley was drunk.

Lockley, who was travelling to visit his Indonesian wife, was shown on local television shortly after the flight surrounded by armed security and a mob of reporters at the airport. Copies of his identification cards were also shown to the media.

He has not made any public comments about the incident and remains in police custody.

Police said Lockley "was still depressed, so he needs to rest."

(Writing by Randy Fabi; Editing by Kim Coghill)