COXSACKIE, N.Y. (AP) _ A 14-hour uprising at a maximum-security prison ended peacefully early today when inmates, who had complained of being harassed by officers, released the last four of their five hostage guards.

Two guards at the state's Coxsackie Correctional Facility were hospitalized and listed in good condition this morning. Three others were treated and released for minor injuries. One inmate received minor injuries.

A guard who went into the prison after the uprising said the inmates had destroyed their unit, designated for inmates with disciplinary problems.

''It was 15 hours of terror'' for the guards, state Corrections Commissioner Thomas Coughlin said.

At a news conference in Albany today, Gov. Mario Cuomo and Coughlin described the uprising as an unorganized chain of events that escalated quicker than the inmates had intended.

''What we're dealing with is a mob,'' Coughlin said. ''It was a bunch of young kids acting as a committee of 32. There was no planning, there was no organization. They knocked an officer down, they took two other officers' nightsticks and they said, 'Oh my God, look what we've done now.'''

Cuomo said earlier, ''A potentially explosive confrontation has been defused without loss of life, or the surrender to any demands.''

Inmates seized the guards about 10:30 a.m. Monday during a recreation period, said James Flateau, a spokesman for the state Corrections Department. The unit housed 32 inmates, but it was not known how many participated in the uprising, said Flateau.

Inmates throughout the prison remained confined to their cells this morning, he said.

Coughlin said he wasn't sure what provoked the takeover, which began when an unidentified inmate attacked guard Lewis Bloom in a recreation yard and took his nightstick. Then seven other inmates overpowered two more guards, took their nightsticks and and command of the unit.

Coughlin said none of the inmates had additional weapons, although he said one may have taken a guard's pocket knife.

Cuomo and Coughlin said no demands were made during negotiations, which were mostly between two inmates and prison Superintendent John Twomey, who was assisted by a department crisis intervention unit.

Cuomo said the inmates had only requested that they not be beaten up when they released their hostages.

''I think they got tired,'' Coughlin said. ''I think they felt very strongly that they were in over their heads after the initial assault and for a number of hours last night, I think they were trying to figure a way out. We just sat back and waited and kept talking to them and kept giving them their options.''

Earlier, Flateau had said some of the inmates had complained about verbal harassment by guards. ''Verbal harassment was the (complaint) they mentioned most often, food complaints, things like that,'' Flateau said. But he later said harassment was not the major point being negotiated.

Outside the prison, which houses 951 inmates, guard Ralph Scott said inmates had been warning for weeks that there might be trouble. In the last two weeks, he said, prisoners' verbal and physical assaults on corrections officers had increased.

But Coughlin said this morning that the prison showed none of the usual signs of an imminent uprising.

''The indicators that I judge were not there,'' Coughlin said. ''Sure, people were saying it was getting tense. Prisons are tense in hot weather.''

Cuomo had said earlier he did not think the generally crowded condition of New York prisons contributed to the problem because ''capacity is not a problem'' at Coxsackie.

Guard David Pratt, 31, of Coxsackie, was upgraded today from serious to good condition with abdominal injuries, said Albany Medical Center spokeswoman Mary MacIntosh.

The three others released this morning - Bloom, 41, of Freehold; Douglas Roberts, 37, of Troy; and John Shipley, 32, of Scotia - were treated and released, she said.

A guard released Monday night, Warren Agostinoni, 28, of Cairo, was in good condition with cuts and bruises, said another spokeswoman, Peggy Pitcher.

Inmate Anthony Milo, 19, was treated for chest and back injuries and released, Pitcher said.

A guard who said he helped carry Bloom out to an ambulance said this morning his colleague was ''badly battered. I believe all of them were.''

Joe Kraft, president of Local 1264 of the prison guards' union, also said broken glass was strewn about the prison unit, there was an inch of water on the ground and cabinets were moved, he said.

''There was probably nothing that could be destroyed that they didn't destroy,'' Kraft said. Coughlin said today that the unit will require repairs but he wouldn't elaborate.