It’s official: Rep. Sean Patrick Maloney, a Democrat from the lower Hudson Valley, is both running for re-election to Congress and for New York state attorney general. While he had already declared his intention to run for the latter job, Maloney filed petitions Thursday at the New York State Board of Election to get on the ballot statewide. That move has brought him into uncharted legal and political territory and given Republicans hope of flipping a swing district that President Trump carried by two percentage points.

However, “in New York, you can’t be on the ballot twice,” said Fred Umane, a commissioner with the New York City Board of Elections. Maloney, he added, has “created a complicated situation that will probably have to be resolved in court.”

In May, New York state Attorney General Eric Schneiderman abruptly resigned amid allegations of physical and sexual abuse against women, leaving the AG race wide open. Although already running for re-election in the 18th Congressional District, Maloney publicly telegraphed his interest in Schneiderman’s job. Now that he’s filed his petitions, the legal wrangling from both the Republican and Democratic sides will begin.

Meanwhile, Rep. Kathleen Rice, a Democrat from Nassau County who has been eyeing Schneiderman’s position for years, declined to run for AG, concluding that state law prohibits someone from running for two offices at once.

Maloney asserts that if he wins the AG primary on Sept. 13, he’ll drop out of his race for Congress. Under this scenario, local Democratic officials would fill the vacancy by picking a candidate to run in November. “The Democrats don’t seem to have a leading candidate in mind,” said Mike Lawler, a Republican consultant working on the race. “No names are circulating.”

Another complication, which may create more lawsuits, is what happens to Maloney’s $3.2 million federal campaign war chest. It is unknown if he can spend money raised for a federal race on a state attorney general’s campaign. It seems likely that one or more of his primary opponents will file a complaint with the Federal Election Commission to try to stop him from using this money.

For now, Maloney is attempting the rare political balancing act of running for two different offices simultaneously. Republicans hope his absence from the district and a lurch to the left to win a Democratic primary will increase the chances for GOP challenger James O’Donnell. A former state trooper, chief of the MTA Police during 9/11, and a local government officeholder in Orange County, N.Y., O’Donnell is making the pitch to voters that serving as their congressman shouldn’t be seen as a consolation prize.

Maloney’s gambit is attracting attention from outside the district. The National Republican Congressional Committee is considering putting O’Donnell on its coveted and well-funded Young Guns program. The Congressional Leadership Fund, which is the super PAC aligned with House Speaker Paul Ryan, is also closely watching the race. The CLF has already reserved around $1 million in television ad time for New York candidates Rep. Claudia Tenney and Rep. John Faso. In June, as it became apparent that Maloney was planning to run for both positions, election watcher Larry Sabato changed his rating of the race from “solidly” to “likely” Democratic.