MARINERS HARBOR (WABC) -- A firefighter shot on Staten Island, sparking a 4-hour standoff with a gunman who ultimately was killed by police, has been released from the hospital.FDNY Lt. James Hayes, 53, was released from Richmond University Medical Center Saturday afternoon after he was treated for gunshot wounds in the buttock and ankle. He is expected to recover.Police said they tried to peacefully diffuse a barricade situation in Staten Island Friday after Hayes was shot, but it appears the gunman had a different plan.The incident started when federal marshals were trying to serve a warrant for a probation violation at the home on Destiny Court at 6 a.m. Garland Tyree, 38, was to be arrested Friday at his girlfriend's apartment in a two-family Staten Island home by four U.S. Marshals and four New York City detectives for violating parole. But he refused to open the door, officials said, and then ignited a commercial-grade smoke bomb, prompting the officers to call the Fire Department of New York.When the FDNY arrived at the scene, Hayes, 53, made contact with a man inside the building, later identified as Tyree. When Tyree stopped talking, Hayes went inside to try to get him out.Once Hayes was in the house, police said Tyree started shooting at him, hitting him twice -- in the left calf and right buttock. A member of the task force fired once at the home as he dragged Hayes to safety, officials said.Emergency crews got Hayes out of the house and to the hospital for treatment.Meanwhile, Tyree, who police said had ties to gangs, barricaded himself in the house, refusing to come out. Police made contact with him with a cellphone at about 6:50 a.m., and even sent in a direct line so they would have an additional way to talk with him. During the more than four hours of discussions between Tyree and police, Tyree fired shots three times, but no one was hit and officers did not return fire.Police said Tyree told negotiators that he wanted to speak with his girlfriend, sister and mother. Police said he did. Then, Tyree said he would surrender in exchange for seeing his mother in-person. At the time, she was in Delaware.The NYPD sent its helicopter to pick her up and bring her to Staten Island.She arrived just before noon, and Tyree talked with his mother and said he would put his gun down and surrender. Shortly before emerging from the apartment armed with the fully automatic AK-47, Tyree told his mother over the phone Friday he had agreed to surrender after a six-hour standoff with police."I'm coming out, Mama," he said, according to the New York Police Department's top hostage negotiator, Lt. Jack Cambria.Instead Tyree, a wanted high-ranking member of the Bloods street gang, fired his weapon at police, and was shot and killed in return.No officers were hit but, several law enforcement vehicles were struck by bullets. Officers returned fire and Tyree was shot. He died at the scene."This is not the way we want these kinds of negotiations to end. The vast majority of the time - the hundreds and even thousands of times we do these each year - it is not how it ends," Police Commissioner Bill Bratton said. "The officers on this scene were exemplary today, despite the outcome. It's hard work, and they did it well."Police combed through the house to check for bombs or other devices, but only found a commercial-grade smoke bomb that was set off in the morning -- so there was no fire at the house. Officers found assault rifle set to full automatic with at least 100 available rounds.Commissioner Bill Bratton said Tyree had a considerable arrest history and was "a very dangerous man." Records showed he had at least 18 prior arrests and had been on probation since last summer. He was also listed in a database as being a member of the 93K bloods gang.In total, he was arrested 18 times and convicted in 2004 on federal gun charges for which he was sentenced to 10 years in prison, officials said. Tyree was convicted in 1995 of weapons charges connected to a murder and subsequently was convicted of two slashing assaults while in custody - one with a razor while aboard a correctional bus and another so vicious the other inmate received 60 stitches.His current defense attorney declined to comment. But in court papers, his lawyers portrayed him as a deeply troubled man struggling with mental health problems, whose mother was addicted to crack, forcing him to be placed in group homes and foster care.Susan G. Kellman, who represented him on the 2004 gun case, described him as "a really smart young man who's never caught a break." "He managed to turn everything good that came his way into something bad, which is what happens when you grow up in a crack-infested environment," Kellman said.Tyree had been on parole since last summer and in February surrendered on a warrant at his girlfriend's home without incident, authorities said. He had violated parole before and in a July 2013 letter, federal prosecutors said he attended a 2012 meeting of gang members, used drugs and was paid dues by other gang members. In a court proceeding, Tyree denied he was still a Blood.On Friday, police said Tyree had posted on Facebook at about 7 a.m., "Today, I die."Hayes was the first FDNY firefighter shot in the line of duty in 21 years.FDNY Commissioner Daniel Nigro held a news conference on the wounded firefighter: