MIAMI (AP) _ The first time Luis Gomez was arrested for taking his girlfriend hostage and threatening to shoot her, Metro-Dade detective Alfredo Hidalgo-Gato sighed with relief.

The second time it happened - two days later - the detective got mad.

On Jan. 8, Gomez barricaded himself inside his suburban Miami townhouse and held his live-in girlfriend hostage with a .25-caliber handgun. After a tense confrontation with police, Gomez surrendered and was arrested.

Another potential tragedy defused, said Hidalgo-Gato, who made the arrest and charged Gomez with four felonies.

Two nights later, Hidalgo-Gato was awakened by a phone call. Gomez was at it again, barricading himself in the same house, holding the same woman hostage, police said.

This time, however, Gomez had a submachine gun.

The siege lasted six hours, during which Gomez fired intermittently from the second story of the house, police said. A policeman and the hostage's brother were shot, and both lay bleeding and unattended for an hour outside the house. Whenever any of the 60 officers on the scene attempted to rescue the victims, Gomez opened fire.

''It was one of the most difficult hostage situations I've ever seen,'' said Metro-Dade Police Cmdr. William Johnson. ''He was armed with a very powerful machine gun, shooting at will at anything that moved, in a high- density housing area.''

At dawn, Gomez finally surrendered. Neither he nor his girlfriend was injured. The two shooting victims are recovering. But several questions remain.

''Why was Gomez released without bond?'' asked Hidalgo-Gato. ''He needed to be locked up and given a psychological evaluation. This never should have happened.''

But felony suspects are released by the thousands each year in Dade County, where overcrowded jails and book-length court dockets force judges to make rapid-fire decisions on whether a suspect should be held or released until his court date.

Under Dade's pre-trial release program, 9,000 suspects a year, most accused of felonies, are freed without bond.

The federal government has fined Dade County and threatened to close its jail unless the inmate population is reduced. In an effort to comply, the county routinely releases suspects such as Gomez.

''I think the pre-trial release program is used too liberally,'' said Dade assistant state attorney Bill Howell. ''Too often people with very recent criminal histories and psychological problems are released.''

When Gomez, 32, was arrested the first time he was charged with false imprisonment, aggravated assault, resisting arrest and gun violations. Gomez, who had several misdemeanors but no felonies on his record, said he feared for his life because he had ripped off a drug dealer, Hidalgo-Gato said.

After one night in jail, Gomez was interviewed briefly by officials of Dade's pre-trial release program. Although officials did not get in touch with the woman held hostage, they recommended Gomez be released pending further court appearances.

Dade Judge Meek Robinette agreed.

''I processed 120 cases that day,'' said Robinette. ''I can't possibly research every case. It was recommended Gomez be put in the pre-trial release program, and no one from the state attorney's office objected. I can't just order a psychological evaluation because I don't like the suspect's looks.''

Tim Murray, director of the pre-trial release program for Dade County, said 95 percent of those freed return for subsequent court dates without further incident. That figure is comparable to those released on bond, he said.

''We judged Gomez to be an acceptable risk, and in this case we were wrong,'' he said. ''We have failures in this program. But overall I think the record is excellent. We don't have nearly enough space to keep every suspect locked up. Every major metropolitan area in the country has to make these kinds of decisions on a daily basis.''

But police say mistakes in such a program are inevitable and occur all too often.

''It happens over and over again, so often you almost become insulated to it,'' said Cmdr. Johnson.

''I would like to see some kind of psychological evaluation before somebody is released on bond or pre-trial release in a violent crime,'' said Hidlago- Gato. ''It should be mandatory.''

Meanwhile, Gomez is being held - without bond this time - on seven counts of attempted first-degree murder and one count each of kidnapping, resisting arrest, aggravated assault and gun violations.