A judge has just granted Cain Velasquez bail in his attempted murder case ... paving the way for the UFC legend to be out from behind bars for the first time in over 8 months.
Velasquez's bail was set at $1 million ... and, assuming he posts it, the judge also ordered the former fighter to wear a GPS monitor, and to stay away from the alleged victims in the case.
The 40-year-old has been locked up since Feb. 28 -- after authorities claimed he shot at Harry Goularte, a man who had been accused of molesting one of Velasquez's relatives.