The 24-year-old from the city of Nice had posted a suicide note on his Facebook wall on Tuesday in which he said goodbye to his friends, warning them that "it was not a joke", French daily Nice Matin reported.
The distressing post was seen by two young boys hundreds of miles away in the north of France who had been playing with the man on the social media site.
The pair immediately showed their mother who alerted police to the Facebook post. Facing an apparent race against time, officers contacted the police department that deals with cyber-crime in the hope they could track down the young man.
With the necessary legal permission, investigators from the department were able to find the young man’s address and send a team to his house.
After breaking the door down, they found him lying in his bed with his wrists slashed. He was taken to hospital, where his life is not believed to be in danger.