WASHINGTON - The House voted yesterday to expand federal hate-crime categories to include violent attacks against gays and people targeted because of gender, acting just hours after the White House threatened a veto.

The legislation, passed by 237-180, also would make it easier for federal law enforcement to take part in or assist local prosecutions involving bias-motivated attacks. Similar legislation is moving through the Senate, setting the stage for a possible veto showdown with President Bush.

"This is an important vote of conscience, of a statement of what America is, a society that understands that we accept differences," said House Majority Leader Steny H. Hoyer (D., Md.).

Rep. Barney Frank (D., Mass.), the only openly gay man in the House, presided over the chamber as the final vote was taken.

The vote came after fierce lobbying from opposite sides by civil rights groups, who have been pushing for years for added protections against hate crimes, and social conservatives, who say the bill threatens the right to express moral opposition to homosexuality and singles out groups of citizens for special protection.

The White House said that state and local laws already covered the new crimes defined under the bill and that there was "no persuasive demonstration of any need to federalize such a potentially large range of violent crime enforcement."

It also noted that the bill left other classes, such as elderly people, military members and police officers, without similar special status.

"Our criminal-justice system has been built on the ideal of equal justice for all," said Rep. Lamar Smith of Texas, top Republican on the House Judiciary Committee. "Under this bill, justice will no longer be equal, but depend on the race, sex, sexual orientation, disability or status of the victim."

Republicans, in a parliamentary move that would have effectively killed the bill, tried to add seniors and the military to those qualifying for hate-crimes protection. It was defeated on a mainly party-line vote.

Hate crimes under current federal law apply to acts of violence against individuals based on race, religion, color, or national origin. Federal prosecutors have jurisdiction only if the victim is engaged in a specific federally protected activity such as voting.

The House bill would extend hate crimes to include sexual orientation, gender, gender identity or disability and give federal authorities greater leeway to participate in hate-crime investigations. It would approve $10 million over the next two years to help local law-enforcement officials cover the cost of hate-crime prosecutions.

Federal investigators could step in if local authorities were unwilling or unable to act. House Judiciary Chairman John Conyers Jr. (D., Mich.) said in a statement that state and local authorities would still prosecute the overwhelming majority of such cases and that the bill required the attorney general or another high-ranking Justice Department official to approve any federal prosecutions.

The Senate bill, sponsored by Sen. Edward M. Kennedy (D., Mass.), is named for Matthew Shepard, the gay college student who died after he was beaten and tied to a fence in Wyoming in 1998.

How They Voted

Representatives from the Philadelphia area who voted to expand federal hate-crime categories were Robert E. Andrews (D., N.J.), Robert A. Brady (D., Pa.), Michael N. Castle (R., Del.), Charles W. Dent (R., Pa.) Jim Gerlach (R., Pa.), Tim Holden (D., Pa.), Frank A. LoBiondo (R., N.J.), Patrick J. Murphy (D., Pa.), Allyson Y. Schwartz (D., Pa.), and Joe Sestak (D., Pa.).

Voting against the bill were Joseph R. Pitts (R., Pa.) and Christopher H. Smith (R., N.J.).

Not voting was Chaka Fattah (D., Pa.).