Josh Gracin -- the American Idol Season 2 finalist who left what appeared to be a suicide note that got cops and family scrambling Thursday -- has checked himself into an inpatient facility and is remorseful over the commotion he caused.
TMZ broke the story ... Josh posted a message on Facebook with a clear message -- he was about to take his life. The post read in part: "I loved her for 17 years ... I made mistakes ... I admitted them, told her the truth and she turned her back on me when I needed her help the most."
The post went on: "Pray for my family as they carry on in this world without me. Goodbye."
Cops picked Josh up Thursday night and took him to the hospital. He just released this statement:
"I want to thank you all for your prayers and support. I take responsibility for my actions and apologize dearly for what I have put my family through. With the help of my family and friends, I am getting help."