Jason Valdez held a woman hostage during a 16-hour standoff with Swat…and posted the developments on Facebook.
Valdez barricaded himself inside the Western Colony Inn in the United States, according to AP reports.
"I'm currently in a standoff ... kinda ugly, but ready for whatever," Valdez wrote in his first post.
"I love u guyz and if I don't make it out of here alive that I'm in a better place and u were all great friends."
Valdez said in posts that he was with a woman named Veronica. Police described her as a hostage.
In his posts, Valdez told friends when police shut off the power that his "hostage" was fine - and with him willingly - and that police are jeopardising her life by their actions.
At 2.04am, Valdez posted two pictures of himself and the woman.
"Got a cute 'Hostage' huh," Valdez wrote of the photographs.
At 3.48am, one of Valdez's friends posted that police had a "gunner in the bushes stay low".
Valdez thanked him in a reply.
The final post was at 7.25am on Saturday:
"Well i was lettin this girl go but these dumb b-------s made an attempt to come in after i told them not to, so i popped off a couple more shots and now were startin all over again it seems ..."
Swat officers stormed Valdez's room about 90 minutes later.
When officers swarmed the room, Valdez shot himself in the chest with a handgun, Ogden police said.
He was in critical condition.
Police never fired, Ogden Lieutenant Danielle Croyle said.
Police believe that responses from Valdez's friend gave him an advantage.
It wasn't immediately clear, however, whether police were following the posts in real-time, though the department spokeswoman said officers routinely search the Internet and other sources for background on suspects.
In all, Valdez made six posts and added at least a dozen new friends.
His family and friends responded with 100 comments. Some people offered words of support, and others pleaded for him to "do the right thing".
Court records show Valdez has a criminal history, including convictions for aggravated assault and domestic violence in front of a child.
Authorities are now discussing whether some of Valdez' s friends should be arrested and charged with obstruction of justice for hampering a police investigation.
"We're not sure yet how to deal with it," said Croyle.