Democrats elected Delaware Representative Sarah McBride to a top leadership post on Thursday. This promotion comes two years after she arrived in Congress and faced Republican efforts to ban her from women’s bathrooms. McBride said, "my colleagues demonstrated their values" after years of personal attacks from her political opponents.

Republicans have targeted the Delaware Democrat, the first openly transgender member of Congress, since she came to Washington. Her party just elevated her to a key job.

Two years ago, Representative Sarah McBride arrived on Capitol Hill as the first openly transgender member of Congress and was immediately targeted by majority Republicans who moved to ban her from using women's bathrooms.

On Thursday, on the second anniversary of that day, Democrats elected Ms. McBride, of Delaware, to serve as one of their top leaders, in charge of helping to oversee messaging for a large new majority that has promised major changes.

Her election as a one of a trio of co-chairs of the Democratic Policy and Communications Committee, the No. 8 position in leadership, reflected a swift rise for a first-term lawmaker, and a notable shift in the culture of the Capitol that is underway as Democrats prepare to take power next year. (To wit: the bathroom ban will simply expire next year.)

Some of the Republicans who most frequently badgered Ms. McBride, misgendering her in committee hearings and on the House floor, will be gone from Congress next year. Ms. McBride, 36, on the other hand, will assume a seat at the leadership table for weekly strategy meetings in the speaker's office.

For two years, Ms. McBride rarely engaged with the personal attacks against her, preferring to focus on policy and not be drawn into a partisan culture war. But in an interview in her office this week, she spoke in more personal terms about what the experience had been like and the significance of her ascent to a leadership position.

"Two years ago, I came into this place and was thrust into the middle of the conversation in a way that I wasn't eager to be," Ms. McBride said. "I'm really grateful that after two years of relentless attacks on a community I'm a part of, after two years of some in this building using me as a pawn in their efforts to get attention, after hundreds of millions of dollars spent to demonize people like me, my colleagues demonstrated their values."