House Majority Leader Kevin McCarthy (Calif.), center, speaks as (from left) Rep. Gary Palmer (Ala.), Rep. Liz Cheney (Wyo.), Rep. Jason T. Smith (Mo.), Rep. Steve Scalise (La.), and Rep. Mark Walker (N.C.), listen during a news conference after a GOP leadership election on Capitol Hill, on Wednesday. (Andrew Harrer/Bloomberg News)

Rep. Kevin McCarthy (Calif.) ascended to the top job in House Republican leadership Wednesday, while Rep. Liz Cheney (Wyo.) followed in her father’s footsteps by taking the party’s No. 3 spot.

McCarthy prevailed over Rep. Jim Jordan (Ohio), 159 to 43, according to the House press gallery, while Cheney was elected by voice vote.

Speaker Paul D. Ryan (Wis.) is stepping down at the end of his term in January. That opened up the top leadership spot, which — after the party lost its House majority in last week’s midterm election — will be minority leader.

“We took a beating inside the suburban areas. We’re going to have to work harder,” McCarthy said at a news conference following Wednesday’s vote, acknowledging Republican losses.

He also partially blamed the GOP defeat on former New York mayor Michael R. Bloomberg, who spent more than $110 million in support of Democrats.

McCarthy and Jordan, a leader of the conservative House Freedom Caucus, had announced their bids for the minority leader position. McCarthy, who currently serves in the No. 2 spot as House majority leader, made a bid for speaker in 2015 but stepped aside amid pressure from conservatives. With Ryan’s backing — as well as a close relationship with President Trump — McCarthy triumphed over Jordan.

The California Republican has leveraged his alliance with Trump to his advantage on Capitol Hill, where the president looms large over the House GOP conference. Trump has referred to McCarthy as “my Kevin” since before his inauguration, and McCarthy has at times gone to great lengths to curry favor with Trump, both through legislation — such as by introducing a bill that would appropriate more than $23 billion to Trump’s plans for a U.S.-Mexico border wall — and other means, such as sending the president his favorite candies.

At Wednesday’s news conference, McCarthy accused Democrats of having an agenda focused principally on investigating — and potentially impeaching — Trump. House Democrats have signaled in recent days that they plan to aggressively probe the actions of the executive branch, although they have resisted calls by activists to immediately impeach the president.

McCarthy also claimed that Bloomberg, who is mulling a 2020 presidential bid, had specifically targeted female Republican candidates.

“He focused on women who were Republican, and unfortunately, a lot of races became close. . . . I think that is wrong that someone picked upon gender,” McCarthy said.

He later clarified his remarks, saying that Bloomberg “picked against Republicans, but he spent a great deal amount of money against Republican women.”

McCarthy had come under fire last month for a tweet in which he contended that Bloomberg, environmentalist Tom Steyer and philanthropist George Soros were trying to “BUY the election!” McCarthy later deleted the tweet, which came around the same time that prominent Democrats, including Steyer and Soros, were being targeted by mail bombs.

The No. 2 spot of House minority whip was claimed Wednesday by Rep. Steve Scalise (La.), who serves in the third-ranking role in House GOP leadership. Scalise had considered challenging McCarthy but announced last week that he was pursuing the minority whip spot instead.

Cheney, who first won election in 2016 and is the daughter of former vice president Richard B. Cheney, won the No. 3 spot of House Republican Conference chair. She made her bid for the spot on Nov. 7 with a letter to colleagues in which she criticized Rep. Cathy McMorris Rodgers (Wash.), who has held the position for three terms. McMorris Rodgers announced the next day that she was stepping aside from her leadership role and seeking to climb the ranks of the House Energy and Commerce Committee.

The elder Cheney, who served as GOP conference chair from 1987 to 1989, was present for Wednesday’s vote for his daughter.

“He told me not to screw it up,” Liz Cheney told reporters with a laugh Wednesday afternoon when asked what advice she received from her father.

John Wagner contributed to this report.