The haggling lasted until the very last moment, but Greater Southeast Community Hospital was rescued early yesterday as a squadron of exhausted lawyers completed documents to sell the bankrupt facility to a small, privately held hospital chain.

Minutes after midnight yesterday morning, the new owner, Doctors Community Healthcare Inc. of Scottsdale, Ariz., sent its administrator to take control of Greater Southeast, saving an institution that has teetered on the brink of closure for much of the past year.

The $22.25 million transaction guarantees that the 100,000 residents of the District's Ward 8--which includes some of the poorest neighborhoods in the city--will not have to travel long distances to reach a hospital in an emergency.

It also preserves nearly 900 jobs at the area's largest private employer. The hospital's new chief executive, Ana Raley, said that employees won't see dramatic changes soon.

"There are no planned layoffs," she said. "In fact, we believe that there are many departments that are short-staffed, and we will get the work force up to par."

The deal hit every snag imaginable after Doctors Community proposed it in September. But under the supervision of a federal bankruptcy judge who pushed all parties to work long hours to settle the deal--or risk an order to liquidate the hospital--Greater Southeast, Doctors Community and several vendors, bondholders and government agencies finally reached a consensus in the waning hours of the year.

Failure to reach agreement by Dec. 31 would have left the hospital without cash to operate over the holiday weekend and would have returned the matter to bankruptcy court.

At critical times throughout 1999, elected D.C. officials kept the process alive by passing emergency legislation, supplying bailout cash or applying political pressure on other officials who could influence decisions crucial to the hospital's fate.

Last week, Del. Eleanor Holmes Norton (D-D.C.) facilitated a key compromise--a plan for the hospital to return $3.6 million in Medicare overpayments. Norton contacted the Health Care Financing Administration and the Justice Department to urge them to make final decisions within hours rather than the usual 30 days to bless the five-year repayment plan.

In the end, negotiators divvied up the $22.25 million purchase price among creditors who were owed more than $70 million.

George Gilbert, a physician who was named chief executive of Greater Southeast in late 1998 and was charged with finding a way to keep the financially troubled hospital open, said he was satisfied.

"A lot of folks didn't think we could pull this off, but we did," he said. "That community needs that hospital, and we left that hospital open. So, mission accomplished."

Now the focus shifts to what the new owners will do at the 280-bed facility on Southern Avenue SE.

"It's a great sense of responsibility that we have taken on here," Paul Tuft, chief executive officer of Doctors Community, said minutes after the agreement was signed at a downtown law office. "We are not unaware of all the problems. . . . It's a big job, a big challenge, but it's a privilege, and we're excited about it. Hopefully, there will be a renewed sense of stability for the hospital."

Nurses at the hospital expressed hope for just that: an end to the emotional roller-coaster ride employees have endured.

First came reports of ominous financial problems in late 1998. Then there were threats of missed payrolls, a temporary bailout from the city, Mayor Anthony A. Williams's decision to halt further support, a sharp drop in admissions and the departure of many employees. For months, city officials have been ready to evacuate the facility on short notice.

Now, with the burden of massive debt lifted, things are looking better to the hospital's 200 registered nurses. This week, they approved a contract for 2000 and praised Doctors Community.

"Now we hope for stability and to rebuild this institution to what it was when I came here 17 years ago," said Christina M. Carver, their union shop steward. "We were really pleased with their negotiating style, and we have [an agreement to discuss wages further] in May."

Shantha Murthy, president of the Greater Southeast medical staff, said spirits are up. "The nurses are still waiting to see how things are going to go, and I'm sure there will be issues," she said. "But they are all here."

Raley, 51, is a nurse who worked in the Greater Southeast organization for 10 years. She has been working for Doctors Community as chief executive of its only other area health facility, Hadley Memorial Hospital, since 1994. Hadley is less than two miles from Greater Southeast.

Hadley has a nursing home with 85 beds and 63 beds for general medical patients. Some of those acute-care services will be shifted to Greater Southeast in a move expected to boost patient counts at the hospital from about 190 a day to as many as 220.

Doctors Community officials now plan to parlay Greater Southeast's monopoly over hospital services in Ward 8 into financial strength.

"We're going to be big," Raley said. "We have this entire side of town--Southeast and Southwest, Anacostia and east of the [Anacostia] river and part of Maryland, Oxon Hill and Temple Hills."

Jane Vines, a Congress Heights neighborhood activist and member of the D.C. Commission on Aging, uses the hospital often and said yesterday that she expects Raley to bring about profound change.

"I think things will change under her," Vines said. "She's a rather strict person. She wants things done and from what I've seen she's persistent, so I think it will work under her."

Raley set a goal of breaking even financially in the first year.

"It makes me feel very responsible for turning the place around," Raley said, "and I will."