BUCKEYE, Arizona (CNN) --A female corrections officer who had been held hostage by two inmates for more than two weeks was released Sunday night when her captors surrendered, a prison spokeswoman said.

The standoff ended shortly after 6 p.m. (8 p.m. ET), said Cam Hunter, public information officer for the Arizona State Prison Complex-Lewis, near Buckeye.

The prisoners were taken into custody after releasing their hostage.

"They surrendered according to a negotiated plan," Hunter said.

"There were days and evenings when we thought we were close and we weren't quite there," she said about the negotiators' efforts to end the standoff.

There was a "collective sigh of relief" when the hostage was released and the inmates gave themselves up, Hunter added.

The standoff, one of the longest incidents of its type in U.S. history, began January 18, when two inmates from the high-security area of the Arizona State Prison Complex-Lewis stormed the watchtower, taking the two guards on duty hostage. On January 24, the inmates released one of the hostages, a man, who had minor injuries.

The inmates were identified by prison officials as Rickey K. Wassenaar, 40, and Steven J. Coy, 39. The guards have not been identified.

The negotiations involved the Department of Corrections and other state, federal and local professionals.

"They worked for a peaceful resolution," Hunter said.

She said the officer walked on her own a short distance, then met medical personnel and was taken to a hospital. Hunter said she did not know the woman's condition.

Hunter said officials would now concentrate on securing the tower, gathering evidence and investigating the incident.

Steven J. Coy

Earlier Sunday, one of the inmates had fired a weapon from the prison's observation tower, an Arizona state official said.

No one was injured. Officials described the weapon as firing "less-than-lethal munition."

Less-than-lethal describes munitions such as plastic and rubber pellets that are designed to injure or distract, rather than kill.

Since the crisis began, the 4,400 inmates at the prison near Buckeye have been under lockdown.