From left, Reps. Maxine Waters, Barbara Lee, Jackie Speier and Mark DeSaulnier, all California Democrats, leave the party leadership elections, where Lee was narrowly defeated in her bid for caucus chairman. (Carolyn Kaster/AP)

House Democrats’ close election for caucus chairman left Rep. Barbara Lee and her allies asking: If not now for an African American woman in leadership, then when?

By a mere 10 votes, the California congresswoman lost to Rep. Hakeem Jeffries (N.Y.) on Wednesday in a hotly contested race between two members of the Congressional Black Caucus that divided Democrats on issues of gender and age.

The showdown between the two was celebrated for the guarantee that it would place another African American lawmaker in party leadership in addition to Rep. James E. Clyburn (S.C.), who was elected whip with no opposition. The elevation of Jeffries to the Democrats’ fifth-ranking position immediately touched off talk about him as a future candidate for speaker.

But for Lee and her supporters, the loss was a bitter outcome at odds with the record number of women of color poised to enter the new Congress in January and the often pivotal role of women of color in helping to elect Democrats.

Reflecting on the race, Lee said she saw sexism and ageism at work. Jeffries is 48; Lee is 72.

“I absolutely think that that’s the case,” she told reporters after Jeffries was declared the winner. “That’s something that women, especially women of color, African American women, have to face.”

The midterm election that swept Democrats into power in the House has been noted for drawing a record number of women, including a significant number of women of color, into congressional races.

But despite a historic wave of victories by many of these candidates, Rep. Nancy Pelosi (Calif.) will be the only woman in the Democratic leadership team’s top five spots if she clinches her speakership race in January. Two black women will wield power as committee chairs next year.

By comparison, Republicans have one woman in leadership: Rep. Liz Cheney of Wyoming, who was recently elected conference chair. In the House as a whole, the GOP will have just one African American lawmaker, Rep. Will Hurd of Texas, after the defeat of Utah’s Rep. Mia Love.

The broader Democratic leadership team came into focus after additional elections on Wednesday night and Thursday.

Rep. Ben Ray Lujan (D-N.M.), who is Hispanic, was chosen assistant Democratic leader and Rep. Ted Lieu (D-Calif.), an Asian-American, was one of three co-chairs of the Democratic Policy and Communications Committee.

Separately, Rep. Katherine Clark (D-Mass.) will be caucus vice-chair; Rep. Cheri Bustos (D-Ill.) will be chair of the Democratic Congressional Campaign Committee; and Rep. David Cicilline (D-R.I.) will be DPCC chair.

Age emerged alongside gender and race as a fault line in the Democratic elections. Pelosi and her two top deputies are in their late 70s and have formed the caucus’s top leadership for more than a decade. Allies of Jeffries during the campaign touted his status as a member of Generation X.

Jeffries thanked Lee after his 123-113 victory but declined to address allegations of sexism and ageism in the race, which he called a “friendly contest of ideas.”

“The members of the House Democratic Caucus worked their will,” he said. “I look forward to all of us coming together and moving forward on behalf of the American people.”

Wednesday’s result was the second narrow defeat in as many years for Lee, who lost the race for Democratic Caucus vice-chair by two votes to Rep. Linda T. Sánchez (D-Calif.) in 2016. Representing California’s East Bay, Lee is known for her liberal credentials, including casting Congress’s sole vote against authorizing the use of military force after the Sept. 11 terrorist attacks.

Lee declined on Wednesday to describe the “institutional barriers” she said she confronted during the election. She said only that she received “very interesting” comments as she spoke with colleagues one-on-one.

“I think that you heard and saw what took place,” she told reporters.

Rep. Jackie Speier, a Lee supporter who represents a neighboring district, said she was “disappointed” that gender and age bias could have played a role in her defeat.

“I think Barbara Lee has shown extraordinary leadership in her career,” Speier said. “She appeals to young and old. She has shown the courage to stand when others aren’t willing to.”

Lee had no trouble winning support from the youngest woman ever elected to Congress.

Rep.-elect Alexandria Ocasio-Cortez (D-N.Y.), who has emerged as the face of a new generation of liberal politicians, called attention to her support for Lee on Wednesday using Instagram, posting a photo of her shoes on the carpet of a room where leadership elections took place.

“It is a rare and treasured opportunity to cast a vote that makes you want to cry — to have a choice that encompasses so many values, hopes, and aspirations . . . That’s how I felt today voting for @repbarbaralee,” she wrote over the photo.

Later, Ocasio-Cortez posted a short video of her sitting side-by-side with Lee and other liberal lawmakers.

“This is the Progressive Caucus in the building,” she said. “Women of color!”

Many members declined to say whom they supported for chair, citing the sensitivity of the contest.

Speier said Lee had entered the vote with the belief that she had enough support to win. She called for an end to the secret ballot in leadership contests, suggesting it allowed for duplicity.

“There’s this game that some of my colleagues play where they say one thing to one member and then say something to another member, and you count them and the count’s off,” Speier said.

Lee said that she hoped her run would inspire other women of color to seek leadership positions. She included a reference to the late Shirley Chisholm (D-N.Y.), the first African American woman elected to Congress and Lee’s onetime mentor.

“She used to tell people, ‘If they don’t give you a seat at the table, bring in a folding chair.’ My vision is a leadership table where folding chairs are no longer required,” Lee said.

The contest between Lee and Jeffries was Wednesday’s most uncertain.

Democrats nominated Pelosi for speaker by a vote of 203 to 32. The longtime Democratic leader will claim the role if she wins a majority of votes in the full House in January, an outcome that opponents in the Democratic caucus say they can prevent amid calls for a generational shift in leadership. But Pelosi will need to win over some of the Democrats who voted against her to secure that majority.

Resistance to Pelosi’s bid raised similar questions about sexism and ageism, with supporters pointing to the fact that Clyburn and Rep. Steny H. Hoyer (Md.) were elected Democratic whip and leader in uncontested races after virtually no criticism of their age or performance in past leadership positions.

“I think she’s held to a different standard, and I think that’s unfair,” said Rep. Jim McGovern (D-Mass.), a Pelosi ally.

The anti-Pelosi movement’s most prominent female member down played concerns that the leader was receiving an unjust share of the criticism.

“I have said from the very beginning that this is not personal to Nancy Pelosi,” said Rep. Kathleen Rice (D-N.Y.). “It’s not even just about her — it’s about the entire team. There was no opposition to them.”