The head of the Catholic Church in Libya has refused to flee the country amid crumbling security, saying he would rather risk being beheaded by jihadist militants than abandon his shrinking flock.

Italy evacuated all its nationals from the northern African country at the weekend, as Islamist militants were taking sway, also posting a gruesome online video depicting the slaughter of 21 Coptic Christians on a beach near Tripoli.

Father Giovanni Innocenzo Martinelli, the bishop of Tripoli, however decided to stay back.

"My community is here. How could I give up?" he told Il Corriere della Sera newspapere. "It would be a betrayal."

Martinelli, 73, was appointed the apostolic vicar of Tripoli in 1985, to serve a Christian community then in the high thousands.

However, the continuous fighting that has engulfed the former Italian colony since the overthrow of late dictator Muammar Gaddafi in 2011, has seen most of the worshippers have left the region. Martinelli's flock has been reducing drastically to "about 300 Filipinos", he explained in another interview with La Stampa.

Tripoli is currently controlled by Libya Dawn, an Islamist umbrella group that sized the capital, ousting the internationally recognised government to the eastern city of Tobruk and installing a rival administration this summer.

A more radical group affiliated to the Islamic State (Isis), the Tripoli province of the Islamic State, has also been active in the city, claiming responsibility for a attack on a luxury hotel that killed nine people, including five foreigners at the end of January.

Martinelli said he has seen the beheading video, adding that jihadi militants have also visited his St. Francis Church, threatening to kill him.

"They came to tell me I have to die," he said. But I want people to know that Father Martinelli is well and that his mission could reach its end.

"I've seen the heads cut off and I thought I might also end up that way. And if it is God's will that [my mission] ends with my head being chopped, so be it.

"I am not afraid and I am not going anywhere," he said.