A teen-aged gunman who seized nine persons Wednesday and held off police in a Fairfax County high school freed his final hostage yesterday morning, slid his hunting rifle into a hallway and surrendered, ending a 21-hour siege.

James Q. Stevens, 18, released the last of his hostages at Lake Braddock Secondary School shortly before 10 a.m. after talking by telephone with Rebecca Golas, a 17-year-old student there who had broken off her romance with the young man the night before the incident began.

Stevens, who stormed into the school's offices early Wednesday afternoon and fired an estimated half dozen shots, was charged with nine counts of abduction and one count of possession of a firearm in commission of a felony.

He was taken to Fairfax County jail and held without bond.

Police said Stevens was unaware throughout the ordeal that a 10th person -- Arline Didier, 37, a reading teacher -- had hid on the floor behind some boxes in the office complex. Stevens was charged with abducting the nine others. Each abduction count carries a penalty of up to 10 years in prison in Virginia; the firearm charge carries up to five years.

"We are real happy the way things came off," said Fairfax Police Capt. Andrew Page. "No one was hurt. Things went smoothly. It was a textbook case."

"Thank God," said Shirley Edwards, a family friend of Stevens who had waited outside the school with her husband and daughter throughout the night. "I'm so glad no one was hurt."

Police said Stevens released the nine hostages periodically in exchange for coffee, vanilla ice cream, a pizza, and the use of a telephone to call his family and friends. Early yesterday morning he promised negotiators to free two hostages at 9 and school principal John W. Alwood, whom Stevens believed to be his last hostage, at 10.

"It wasn't a deal," said police policeman Warren Carmichael. "He just said what he was going to do and we said, 'Fine.' And he did adhere to the timetable."

Alwood left his office at 9:45 a.m. and 10 minutes later Stevens pushed his rifle -- a gift from his mother who works for a Washington gun-lobbying organization -- into a hallway. The young man walked out of the office moments later and was taken into police custody.

Most of the freed hostages remained in the massive school building until Alwood's release. The school, the largest in the Washington area with 4,300 students, was closed yesterday because of the crisis.

As hostages were released, they were taken to a room in the school, where families and friends embraced them tearfully. "There were obvious expressions of relief and emotionalism and some crying," said Fairfax School Superintendent William J. (Jack) Burkholder, who had remained at the school throughout the night. "But there were also expressions of concern for those left behind."

Although Stevens did not harm or directly threaten any of the hostages, police said he kept his rifle cradled in his arms or at his side throughout the incident. At times, witnesses said, he appeared suicidal, wishing aloud that police would shoot him and end the siege.

"The only way I'll leave this place is in hearse," Stevens reportedly told one of the many friends he called during the night. Police said he suffered cuts to his right hand when he thrust it through a glass office partition.

Hostage June A. Harrison of Annandale, a 57-year-old school finance officer, bandaged Stevens' wound. Harrison herself later was treated briefly for stress and fatigue after her release Wednesday night.

Stevens, whom witnesses described as calm throughout most of the night, occasionally erupted in anger. When he heard a radio newscast report that his girlfriend had "rejected" him, witnesses said, it set him off on a tirade. "He heard that and it infuriated him," said Burkholder. "He started commenting about 'blowing the place apart.' "

Neighbors in the Heritage Square town house development where he lives said Stevens as a quiet, clean-cut youth who never used drugs or alcohol and was best known among his peers for singing and composing country music. Throughout the night, police said, Stevens called friends and family in Northern Virginia and Texas and laid out his predicament at the school in lucid detail.

"You'd really have to read into it to see whether he was seeking sympathy or seeking attention," said police spokesman Carmichael.

"He told me: 'I don't care what happens. Nobody cares about me,' " said 17-year-old Tammy Edwards of Falls Church, a previous girlfriend who said she received three calls from Stevens during the night. "And I said, 'I care. You don't know how many people care about you.' "

When Stevens ran into the office waving the gun about 1 p.m. Wednesday afternoon, police said, he initially believed that principal Alwood was his only hostage. It was not until more than four hours later that he discovered eight more adults, huddled in a small Xerox room adjacent to the principal's office.

In addition to Alwood and Harrison, police identified the other hostages as:

Frances W. Churchman, 55, a parent from Burke who was visiting the school.

Antoinette H. Crom, 54, of Springfield, an office aide.

Margaret T. Rydeen, 58, of Springfield, a special education teacher.

Carol L. Pogharian, 38, of Fairfax, a media aide.

Frances L. Ramsey, 45, of Springfield, a data processing assistant.

Dale S. Rumberger, 29, of Burke, a drama instructor.

Catherine M. Reppert of Springfield, a data processing assistant.

County officials said as they walked through the building throughout the night they could hear police negotiators shouting to the gunman and Stevens' responses over the school public address system. Fairfax Supervisor Marie B. Travesky said conversations between negotiators and the gunman were sporadic, with as much as an hour passing between some of the exchanges. At times the negotiators simply pleaded, "Why don't you just come out now?" said Travesky.

Police said principal Alwood maintained dialogue in the office with Stevens. "We talked about school things he had done," Alwood told WMAL radio. "But mostly we tried to tell him that he hadn't done anything so serious that he couldn't just pay the price and have a good life."

In another part of the building were the family and friends of the gunman, including Rebecca Golas and her parents, Stevens' mother, stepfather and members of Stevens' family. Early Thursday morning, his father, brother and stepmother arrived from their home in Texas.

Police said that Stevens had a 30-minute conversation with Golas before he surrendered, but declined to reveal what the pair discussed.

Students said Alwood and Rumberger were skilled in dealing with students. They described Alwood as a soft-spoken man who was liked and respected by the student body. "He's on the side of kids," said Greg Richards, a sophomore. "He talks to us logically. He's not like other people who just demand things."

Around midnight police said they also arrested a 37-year-old Burke man carrying a 30-30 rifle with a seven-power scope on the school grounds. Police said Francis Purcell told them he had been watching televised accounts of the incident and drinking rum when he decided to come and "help the kid."

Purcell was charged with public drunkenness and possession of a firearm on school property, and was being held in the Fairfax jail in lieu of $1,000 bond.