Algerian child
Police in Algeria arrested the man for putting the baby's life in danger after these images were uploaded to Facebook. Facebook screengrab

An Algerian man has been handed a two-year jail term after dangling a baby out of a 15th-floor apartment window in order to attract 1,000 "likes" on Facebook, according to reports.

The man, from the city of Bab Ezzouar, east of the capital Algiers, had posted a photo of himself holding the baby out of a window of a block of flats with the caption: "1,000 likes or I will drop him."

When Facebook users spotted the photos, the man was reported to authorities.

He was arrested on Sunday (18 June) and appeared in court charged with endangering the baby's safety.

It was reported that many social media users had responded angrily to the post and demanded his arrest after his dangerous prank.

"What is most striking is that it appears that the father is carrying his son with his left hand while using his right hand to take the picture, this means the picture is more important than the child's life," one user commented on the post, according to The New Arab.

Initially, the man was said to be the child's father but this has since been confirmed as incorrect and the man was a relative of the toddler.

The BBC reported that Algeria's privately owned Ennahar TV reported that the man had denied that he had actually put the child's life at risk.

He also said that the image had been altered by social media users online.

"The picture was taken in a balcony with protective barriers. These were removed (from the image)," he was quoted as saying.

During the man's hearing, the child's father urged the court to forgive the man, saying he had just been playing a game, and had never planned to drop the child. But the judge did not agree and said that the picture was clear evidence that the child's life was in danger.