Four foreigners have been arrested in the eastern Libyan city of Benghazi on suspicion of being Christian missionaries and printing books about Christianity, a security official has said.

The arrests were announced on Saturday as thousands of people gathered in Tripoli, the capital city, and Benghazi to celebrate two years since the start of the revolution that ousted long-time leader Muammar Gaddafi.

"They were arrested on Tuesday at a publishing house where they were printing thousands of books that called for conversion to Christianity," security official Hussein Bin Hmeid said.

"Proselytising is forbidden in Libya. We are a 100 percent Muslim country and this kind of action affects our national security."

Hmeid said the government-affiliated security apparatus called the Preventative Security, for which he is a spokesman, had arrested an Egyptian, a South African, a Korean and a Swede who was travelling on a US passport.

"We are still holding interrogations and will hand them over to the Libyan intelligence authorities in a couple of days," Hmeid said, without giving further details.

The Preventative Security apparatus is a parallel security body created during the 2011 war that ousted Muammar Gaddafi and made up of several rebel brigades which fought in the conflict.

Libya's central government has yet to impose its authority on a myriad of armed groups who have yet to lay down their arms, and with skeletal national security forces, often relies on them for security.