(Please Note: The language in paragraphs 8 and 9 may offend some readers)

MANILA (Reuters) - Philippine President Rodrigo Duterte has promised to stop swearing, saying God spoke to him on a flight from Japan on Thursday, warning him the plane would crash if he kept using bad language.

The maverick former mayor, famous for profanity that has included outbursts aimed at Pope Francis and U.S. President Barack Obama, said he heard a voice and realised it was God, telling him to clean up his act.

“I was looking at the skies while I was coming over here ... everybody was asleep, snoring, but a voice said that, ‘you know, if you don’t stop epithets, I will bring this plane down now’,” Duterte said at a news conference late on Thursday upon arrival in his home city of Davao.

“And I said, ‘who is this?’ So, of course, it’s God. OK.

“So, I promise God ... not to express slang, cuss words and everything.”

Duterte, a former outspoken city mayor, emerged as a brash, crass, alternative candidate in a May election which he won by a big margin, owing much to his earthy style and promises to tackle problems important to ordinary people, like drugs and crime.

Philippine President Rodrigo Duterte gestures while answering questions during a news conference upon his arrival from a state visit in Japan at the Davao International Airport in Davao city, Philippines October 27, 2016. REUTERS/Lean Daval Jr

Advice to act more presidential once he took office was not heeded for long, however, and he resumed his eruptions of profanity with gusto when he started hearing foreign criticism of his deadly drugs war.

He has called U.S. President Barack Obama a “son of a bitch” and chose the same words when criticising the pope.

He told Obama to “go to hell”, called U.N. Secretary-General Ban Ki-moon a “devil” and said “fuck you” twice to the European Union, while raising his middle finger.

In Tokyo on Tuesday, Duterte used the same language when speaking about his anger with foreign criticism of his drug war.

In Washington, State Department spokesman Mark Toner declined to say whether Duterte’s vow might make dealing with him easier, but added: “He’s certainly entitled to his views about his own relationship with a supreme being.”

It was not the first time Duterte has spoken of his connection with God, whom he said had made him president.

Alan Peter Cayetano, Duterte’s vice-presidential running mate and now his foreign affairs adviser, said Duterte was tired and appeared pensive during the flight back from Japan.

“He felt it was a message from God,” Cayetano told reporters on Friday.

“I’ve always felt he’s a deeply spiritual person. He’s not religious, but he believes in God.”

The Philippines is predominantly Roman Catholic.