Before he died of AIDS, the state's first openly gay lawmaker asked a friend for a promise: that he would keep working on gay civil rights legislation.

That was more than a decade ago. Now, the legislation Cal Anderson championed, 30 years in the making, is about to become law.

"I remember the day that Cal told me he didn't have much longer to live," said Rep. Ed Murray, a Seattle Democrat and one of four openly gay lawmakers now in the Legislature. "One of the things he asked was if I would continue work on this bill."

On Friday, the Senate passed the legislation 25-23, with a lone Republican joining Democrats in voting in favor. The House approved it 61-37, and Democratic Gov. Christine Groggier said she would sign it Tuesday.

Murray was given a standing ovation when it passed the House, and colleagues surrounded gay lawmakers to congratulate them.

"History is going to look kindly upon the legislators who had the courage to vote for this," said Rep. Dave Upthegrove, who cried when the bill passed the House. "It's a great day for equality, for fairness."

First introduced in the 1970s, the measure adds "sexual orientation" to a state law that bans discrimination in housing, employment and insurance, making Washington the 17th state passing a law covering gays and lesbians. It is the seventh to protect transgender people.

Sen. Bill Finkbeiner was the only Senate Republican to endorse the measure. Two Democrats voted against it.

"We don't choose who we love. The heart chooses who we will love," Finkbeiner said. "I don't believe that it is right for us to say ... that it's acceptable to discriminate against people because of that."

The bill was amended by Republicans on the House floor to say that it would not modify or change state marriage laws. A Senate amendment added a caveat saying the state does not endorse "any specific belief, practice, behavior, or orientation."

Sen. Dan Swecker, R-Rochester, who voted against the bill, said it would "trample unrelentingly" on religious viewpoints that object to gays.

"We, the state, are telling people to accept, actually to embrace, something that goes against their religious views," he said.

The bill could still be challenged. Opponents have suggested pursuing a referendum, giving voters the option to overturn the measure. They would need about 112,000 signatures to get a referendum on a November ballot.

Gregoire said she would fight any effort to undo the law.

"I will fight any initiative, any referendum that tries to take back the equality these folks and others around our great state have been given today," she said.

Murray said he fully expects a battle at the ballot box, but asked opponents to consider one thing.

"Before you reach for a pen to sign an initiative to end our rights, call up somebody in your life who is gay or lesbian and talk to them about their reality, and then decide whether you want to pick up that pen," he said.

Anderson's partner of 10 years, Eric Ishina of Seattle, carried with him Friday a picture of Anderson with his Senate colleagues. Anderson fought for the bill for eight years before he died.

"I don't doubt that he's really smiling down on us right now," he said.

Ishina said Anderson knew that the law would eventually pass, saying: "Otherwise, he would not have kept fighting, year after year."