The referendum that would have restored the right of homeless people in the District to have overnight shelter on demand was defeated by a narrow margin last night.

Voters in the final tally gave a narrow margin of 2 percentage points to those opposed to Referendum 005.

"We will have a new mayor and the defeat of 005 will free her hands to be the mayor," said Jim Lawlor, co-chairman of Citizens Opposed to 005.

The defeat of the referendum means that the amendment passed during the summer by the D.C. Council to the Right-to-Shelter Law would stand.

The amendment took away the absolute right to shelter on demand, limited the length of stay in a shelter and required adult residents to receive job counseling.

Opponents of the referendum included Mayor-Elect Sharon Pratt Dixon, most council members and the two umbrella neighborhood associations that represent most community groups throughout the city.

Their main concern was the escalating cost of providing shelter on demand.

Last year the city budgeted $40 million for overnight accommodations for homeless people.

Last night, council member H.R. Crawford (D-Ward 7) who led the fight in the council for the amendment limiting the right to shelter, said he was "extremely pleased" by the defeat of the referendum.

"Our intent was never to be mean but to develop parameters, keeping in mind the fiscal restraints of the city," he said.

"Now maybe we can sit down and work together with the advocates to resolve the plight of the homeless in the city."

Carol Fennelly, a leader of the Community for Creative Non-Violence and the chief spokeswoman for advocates of the referendum, could not be reached for comment on the returns.

Earlier in the evening, she said she was confident that her side would win but she said it would be a close race.

She said the referendum was a "real test for the issue of homeless rights nationwide. A lot of people are looking to see how this one will go."

The District's shelter initiative, approved in 1984, was the first voter mandate guaranteeing overnight shelter to homeless people who request it.

The early returns yesterday showed Wards 1, 5, 7 and 8 voting to pass the referendum.

Ward 3, with the city's most affluent neighborhoods, gave the opponents their strongest endorsement, with 56 percent of the voters saying no, and 28 percent voting yes.