EXCLUSIVE

War Machine tried to kill himself in his Las Vegas jail cell this week ... but his attempt was foiled by a corrections officer.

Law enforcement sources tell TMZ ... Tuesday night around 9:30 an officer was walking by War Machine's cell in Clark County Jail. The officer saw him sitting on the ground with his feet up on the bunk bed. When the officer called to him he was unresponsive.

The officer went into the cell and found the ex-MMA fighter had a piece of linen around his neck which was tied to the leg of the bed -- and his face was purple. The officer cut the linen, removed it ... and we're told War Machine's breathing became less strained and he attempted to speak.

He's currently in a medical isolation cell on suicide watch. We're told officers found what appeared to be suicide notes in the cell.

War Machine is in jail awaiting trial for the attempted murder of his ex-girlfriend, porn star Christy Mack, and her friend Corey Thomas.