Nearly 100 people filed to run for Congress in Pennsylvania by the deadline Tuesday, a surge that reflected the political volatility in the state and nation.

Democrats across the country have been raring to send a political message to President Trump in November, and the landscape is especially wide open in Pennsylvania, where a wave of incumbents are leaving office and new congressional maps increased the number of competitive battlegrounds.

In all, 59 Democrats and 35 Republicans filed to run for the state's 18 House seats as of 5:40 p.m., or 40 minutes after the deadline, according to the Department of State.  That was a few dozen more than the peak of the last major election wave, the 75 candidates who registered to run in what became the GOP landslide of 2010.

As during that midterm election, incumbents this time around also face stiff challenges — including many from within their own parties — and open seats have drawn swarms sensing opportunity.

"You pair the redistricting and the enhanced competitiveness in the new districts with a number of open seats, and you have the recipe for a flood of candidates giving it a shot," said Christopher Borick, a pollster at Muhlenberg College.

The surge of Democrats came as the party tries to build off a special election upset in Southwestern Pennsylvania last week and looks to the Philadelphia suburbs as a key to winning control of the House.

But the large roster of candidates also foreshadows an unpredictable and potentially divisive primary season in a party where pragmatists and fiery liberals have vied for influence. Fourteen Democrats and two Republicans filed to run for one seat based in Delaware County, where the longtime incumbent, Republican Rep. Pat Meehan, is retiring after using taxpayer money to settle a sexual harassment claim from a former aide.

"Primaries could be messy, especially crowded ones, and they could end up with candidates who may not be the best general election candidate for a party," Borick said.

Republicans, meanwhile, face stiff headwinds, due to Trump's poor poll numbers and a history of midterm losses for the party in power. Their road got even tougher when the Democratic-controlled state Supreme Court imposed new congressional maps just last month.

"Our president has inspired the Democratic Party base and even more broadly independents and independent-thinking Republicans," said Jack Hanna, the party's interim chair in Pennsylvania. "More and more people within the party are involved and want to challenge the status quo, and that's being reflected by the number of candidates running in the primary."

In a the most visible sign of the GOP's uncertain footing, Rep. Ryan Costello of Chester County filed petitions to get on the ballot Tuesday, but has not committed to actually running for reelection. He has warned GOP leaders in recent weeks that he is considering retiring, but has not decided.

Costello, a two-term incumbent, represents one of the country's most hotly contested districts, the newly reconfigured Sixth, and is facing a challenge from Democrat Chrissy Houlahan. If he were to retire, election analysts say, the GOP would likely lose the seat.

"Congressman Costello's going to have to make a final determination, and we'll cross that bridge when we come to it," said Val DiGiorgio, chair of both the Pennsylvania and Chester County Republican Parties. "I have not heard definitively one way or the other. I know he's filing his petitions and doing all the things a candidate would do, so I'm proceeding under the assumption that he's running."

If Costello wins the May 15 primary and then drops out, Republicans could replace him with a choice picked by the state party. He also faces a primary challenge from Chadds Ford lawyer Gregory Michael McCauley Sr., which could complicate that scenario.

Conor Lamb, the Democrat who apparently scored a major upset in the special election outside Pittsburgh, filed to run another difficult race, against Rep. Keith Rothfus in the new Pennsylvania 17th — even though Lamb has not yet been sworn in to the seat he likely won. Lamb's home is in the new district.

While a matchup with Rothfus could be one of the fall's most competitive, Lamb, who defied Democratic orthodoxy on issues such as guns and the minimum wage, first faces two primary opponents.

Other incumbents, including Philadelphia Democrats Dwight Evans and Brendan Boyle and Bucks County Republican Brian Fitzpatrick, drew primary challengers. Democrats also have a primary fight for the nomination to challenge Fitzpatrick.

Boyle, however, avoided one primary challenger: Almost exactly 24 hours before Tuesday's deadline, School Reform Commission member Bill Green told the Inquirer and Daily News that he was dropping his campaign against the incumbent.

Much of the chaos stems from congressional departures affecting six of 18 seats: One, Republican Tim Murphy, resigned last year, four others are retiring, and one, Republican Lou Barletta, is running for U.S. Senate.

In the Lehigh Valley-based Seventh District, six Democrats and two Republicans filed to run to replace Rep. Charlie Dent, another retiring GOP congressman.

Four Democrats and one Republican filed in a new district centered on Montgomery County.

The new congressional boundaries, imposed Feb. 19 by the state Supreme Court, changed the political landscape. The court dismissed a previous map, drawn by Republicans, as unconstitutionally slanted to favor the GOP, and later imposed a new version that resulted in a more even split statewide, turning several GOP-leaning districts into ones likely to favor Democrats.

"The chaos that the Supreme Court has sown is more than a little troubling," DiGiorgio said. "People don't know who represents them and candidates are still deciding at this late date if they are running."

On Monday, a day before the primary filing deadline, the U.S. Supreme Court and a federal court in Pennsylvania rejected Republican challenges to the new map.

The fallout continued Tuesday, when the majority leader of the Pennsylvania House, Republican Dave Reed of Indiana County, announced that he was dropping a bid for Congress and leaving leaving elective politics. He blamed his decision on the new lines that put him in the same district as an incumbent Republican congressman, Glenn Thompson.

The new configuration has added to GOP concerns as they face what could be a brutal election environment, given the long history of midterm losses for the party in power and Trump's poor approval ratings, particularly in the competitive suburbs.

"The party's got to be unified," DiGiorgio said of the GOP. "There was not unity in that race in Southwestern Pennsylvania, and we have to be unified given this year given the challenges we face with a midterm election."

He said Republicans would emphasize that they are up against "a far-left Democratic Party that is for socialism, sanctuary cities, and single-payer health care."

He also predicted that the GOP tax cut from last year will gain in popularity and help at the polls.

This story contains information from the Associated Press.