Political leaders from across the world have expressed their condemnation at the deadly shooting at two mosques in New Zealand on Friday.

Forty people were killed and at least 20 suffered serious injuries in ''terrorist'' shootings targeting the mosques during Friday prayers in the city of Christchurch, Prime Minister Jacinda Ardern said.

Police say three men and a woman are in custody in connection with the attacks.

The timing of the shootings and the posting on social media of what appeared to be live, point-of-view video footage of the assault by a gunman, added to the distress of many.

Here is how political leaders around the world reacted soon after the incident.

Indonesia

Indonesia, the world's biggest Muslim-majority country, strongly condemned the shooting as authorities were checking on whether any of its citizens were victims.

"The government and the people of Indonesia convey deep condolences to the victims and their families," Foreign Minister Retno Marsudi said in a statement.

She was earlier cited by media as saying six Indonesians had been inside the mosque when the attack occurred, with three managing to escape and three still unaccounted for.

Malaysia

In Muslim-majority Malaysia, Anwar Ibrahim, the leader of the biggest party in its ruling coalition, said one Malaysian had been wounded in the attack he described as a "black tragedy facing humanity and universal peace".

"I am deeply saddened by this uncivilised act, which goes against humanistic values and took the lives of civilians," he said in a statement.

"We extend our deepest sympathies and condolences to the families of the victims and the people of New Zealand."

Turkey

Turkish President Recep Tayyip Erdogan's spokesman condemned what he called a "racist and fascist" attack.

"This attack shows the point which hostility to Islam and enmity to Muslims has reached," Ibrahim Kalin wrote on Twitter.

"We have seen many times Islamophobic discourse against Islam and Muslims turning into a perverse and murderous ideology. The world must raise its voice against such discourse and must say stop to Islamophobic fascist terrorism," he said.

Afghanistan

Afghanistan's ambassador to Australia, New Zealand and Fiji, Wahidullah Waissi, said on Twitter three Afghans had been wounded.

"My thoughts are with the family of Afghan origin who've been shot and killed at this heinous incident."

I am receiving terrible news out of Christchurch mosques’ shootings. My thoughts are with the family of an Afghan origin who‘s been shot and killed at this heinous incident and with three other Afghans who are injured. Watching this closely as the situation is still unfolding.

Pakistan

Pakistan's Foreign Ministry spokesman Mohammad Faisal condemned the incident on social media, using the hashtag #pakistanagainstterror.

"Foreign Minister Shah Mahmood Qureshi has condemned in the strongest terms the tragic terrorist attack in #Christchurch, #NewZeland," he wrote in a tweet.

"FM has expressed condolences over loss of innocent lives in the heinous attack," he added.

Australian Prime Minister Scott Morrison said his country stood with New Zealand after the tragic attack.

He confirmed media reports that the gunman who mowed down worshippers in the main mosque in the southern New Zealand city of Christchurch was an Australian-born citizen, without providing further details.

"We are not just allies, we are not just partners, we are family," he said.

"It is such a sad and devastating reminder of the evil that can be ever present about us," Morrison said of the attacks.