Pat Ryan, a Democrat, won a special election for New York's 19th Congressional District in a race that gained national attention.

The contest was seen as a bellwether of the national mood because Ryan had focused on abortion rights while his opponent had tried to run on issues embraced by the GOP. Democratic hopes that they can retain control of Congress in November will likely be boosted by Ryan's victory.

Ryan surged late in the race for the district that spans up the Hudson Valley north of New York City. The Republican nominee for governor was the executive of the county.

Democratic candidate Pat Ryan speaks during a campaign rally, Monday, Aug. 22, 2022, in Kingston, N.Y. Ryan is facing Republican Marc Molinaro in Tuesday's special election for New York's 19th Congressional District. (AP Photo/Mary Altaffer)
Democrat Pat Ryan speaks during a campaign rally, Monday, Aug. 22, 2022, in Kingston, N.Y. (AP Photo/Mary Altaffer)

Ryan's campaign was dominated by abortion rights. Ryan released his first ad within an hour of the Supreme Court's decision.

Ryan said that freedom included a women's right to choose. If the government wants to control women's bodies, how can we be free? His yard signs said, "Choice is on the Ballot."

He supported exceptions for rape, incest and the health of the mother, as well as opposing a federal ban on abortion.

Democrats said that he couldn't be trusted because of his opposition to allowing Medicaid funds to be used for the procedure while serving in the state assembly. They criticized him for his appearances with an ardent supporter of former President Donald Trump.

Republicans wanted the race to be a referendum on Biden while portraying Ryan as a progressive on criminal justice issues. The National Republican Congressional Committee spent more than $1 million on an ad that said that Ryan Hurts Cops. Helping people who are committing crimes.

UNITED STATES - AUGUST 18: Marc Molinaro, Republican candidate for the New York 19th Congressional district, speaks on Thursday, August 18, 2022. (Bill Clark/CQ-Roll Call, Inc via Getty Images)

The seat became vacant when the Democrat who had won it in the last election left to become New York's lieutenant governor.

The 19th is an example of a swing district. In 2008 and 2016 the president carried it. After voting for Donald Trump, it went for Biden.

Democrats hope that abortion rights will get people to vote. The defeat of an anti-abortion ballot initiative in Kansas, as well as close races in Nebraska and Minnesota that seemed indicative of Democratic strength, led to Ryan's victory.

Ryan is only assured of a congressional seat for a few months even though he won. Ryan will be running in the 18th district where his home is located, while Ryan will be running for the 19th district seat, leaving open the possibility that both men will serve in the House next year.