Justin Bieber turned to the Lord while being shaken down over his racist videos -- and TMZ has learned he washed away his sins with a baptism performed in a bathroom.
Pastor Carl Lentz -- who works with Bieber in NYC -- tells us he spent a week doing intense Bible study with Justin last month ... in the wake of being extorted over the videos.
As we previously reported -- JB's team was contacted 2 months ago by a man in possession of the videos and wanted a million dollar payday or else he'd go public.
We're told Bieber's religious resurgence focused on studying Bible passages and attending services ... culminating in an actual baptism performed in the bathtub of one of the singer's friends.
Why a bathtub, you ask? We're told JB previously checked out a bunch of churches for the dip -- but his cover was blown every time and he wanted to keep the whole thing private.
Justin's now got a clean slate with God -- but the public is a harder nut to crack.
If we confess our sins, he is faithful and just to forgive us our sins and to cleanse us from all unrighteousness.
ONTD, what was the last prayer circle you held about?