The battle for Republican Dave Brat’s suburban Richmond congressional seat has spawned a flurry of TV ads on a subject few saw coming as the midterms kicked off: Democrat Abigail Spanberger’s substitute-teaching job at a Saudi-funded Islamic school in Northern Virginia.

Spanberger taught English literature at the Islamic Saudi Academy in Alexandria for part of the 2002-2003 school year as she was waiting out the long security-clearance process needed to work as a postal inspector and CIA officer.

Critics have dubbed it “Terror High” because some students joined al-Qaeda years after graduating. Spanberger received two federal security clearances after disclosing her teaching work to the Postal Service and the CIA, which eventually sent her overseas as a covert agent fighting terrorism.

The Congressional Leadership Fund, a super PAC aligned with House Speaker Paul D. Ryan (R-Wis.), aired an anti-Spanberger ad last week that centered on her work at the school.

“What is Abigail Spanberger hiding?” a narrator asks as ominous music plays in the background. “Spanberger doesn’t want us to know that she taught at an Islamic school nicknamed ‘Terror High,’ a terrorist breeding ground. One graduate plotted to assassinate President Bush. Another was arrested for trying to bring a butcher knife on an airplane. So dangerous, even [Sen.] Chuck Schumer called for the school to be shut down. But Abigail Spanberger cashed her paychecks like nothing was wrong.”

Along with images of a locker-lined school hallway, the ad shows a mash-up of an airplane cabin, a terrorist’s mug shot and a red-tinged knife.

Spanberger responded with two ads of her own.

“Dave Brat and his allies will do anything to keep power, like smearing Abigail Spanberger, a CIA officer who risked her life fighting terrorists,” begins the first 30-second spot, launched late last week. “The Washington Post called the attacks ‘outrageous and worrisome,’ saying, ‘We should all be alarmed.’ National security officials call it ‘political retribution’ that ‘violated the trust of one among our ranks.’ A Republican strategist called it an ‘atrocity.’ They’ve crossed the line. Shame on Dave Brat.”

Viewers see images of Spanberger lying flat on the ground and firing a gun for weapons training and standing beside Michael V. Hayden, former director of the CIA and the National Security Agency, and former CIA deputy director Stephen Kappes.

Spanberger launched a second ad this week that also pushes back, but with a much softer tone. The 30-second spot features John Sipher, a 28-year veteran of the CIA’s National Clandestine Service whose career included serving in Moscow and running Russia operations.

Piano music plays softly in the background as Sipher, who appears to be sitting in someone’s home, speaks.

“Associating Abigail with terrorism is laughable,” he says. “Abigail worked on the front lines. She chose to do the hardest work that this country asks of anybody. She focused on protecting Americans from terrorism, not sniping from the sidelines. The CIA trusted her with top-secret security clearance. For Dave Brat or anybody else to twist that and turn it against her and claim that Abigail aided terrorists, it’s dangerous and it’s unpatriotic.”

Each side called the other’s ads deceptive.

“Abigail served for over a decade to keep our country from threats and received Secret and Top Secret . . . clearances based on her background, experience, and integrity,” Spanberger spokesman Justin Jones said in a statement. “These baseless and false attacks are a desperate and weak attempt by Congressman Brat’s allies to distract from the fact that he has failed Virginia’s 7th District.”

Brat spokeswoman Katey Price said in an email: “Spanberger is so out-of-step with voters that she told the New York Times she is proud of working at an anti-American school that groomed terrorists. . . . We trust the voters will see through the Spanberger misinformation campaign and re-elect Congressman Dave Brat.”

Brat’s campaign was not responsible for the anti-Spanberger ad, the work of a PAC legally barred from coordinating with the campaign. Brat is not prohibited from working with the state GOP, which echoed the PAC’s allegations about Spanberger’s teaching job.

Brat was initially silent on the PAC and party claims, with his campaign not responding to requests for comment. But he adopted their line of attack on “The John Fredericks Show” late last week.

“They’ve produced terrorists. They’re called ‘Terror High,’ ” Brat said. “They’re openly anti-American, anti-women, anti-Israel, anti-Semitic and anti-Christian. All of that is out there. In five seconds of blogging, you can find out about the school by reputable news reports back then.”

The school drew controversy after Ahmed Omar Abu Ali, its 1999 valedictorian, was convicted in 2005 on charges of providing material support to the al-Qaeda terrorist network and sentenced to 30 years in prison. Two other students were accused of preparing for suicide bombings. And the U.S. Commission on International Religious Freedom raised questions about the textbooks used at the school, saying they used language that promoted violence and religious intolerance.

In 2005, Schumer (D-N.Y.) called for the school to be investigated as a possible “breeding ground for anti-American sentiment.” Schumer, now the Senate minority leader, issued a statement Tuesday saying his words had been twisted to try to tar Spanberger.

“My comments about ISA were made in 2005, immediately following my earliest concerns about graduates of this school,” he said. “I strongly condemn anyone using those comments about this school as a way to attack an upstanding patriot and former CIA officer Abigail Spanberger, who had left the school years before and had absolutely nothing to do with my concerns.”

Spanberger filled in for a teacher there who was on maternity leave during the spring semester of the 2002-2003 school year, continuing until the teacher returned partway into the 2003 fall term. She took the job after she had gotten a conditional offer from the CIA and was waiting for her security clearance.

She updated her clearance application, known as Standard Form 86, to note that she had taken the teaching job, identifying the school by name. She later got a job as a postal inspector and finally started with the CIA in 2006.

The Republicans’ “Terror High” allegations have been complicated by controversy over how they obtained the information on the teaching job: It was listed on the SF86, a confidential questionnaire. The form contained sensitive personal information, including Spanberger’s Social Security number and medical history. The government is prohibited from releasing that information, under the Privacy Act of 1974.

The Postal Service has acknowledged that it should not have released the questionnaire to America Rising, a GOP opposition research firm that then shared it with Ryan’s PAC. The Postal Service blamed the release on “human error,” saying an employee in a new position mistakenly handled the personnel records request as if Spanberger were asking for her own records, instead of as a freedom-of-information request from a third party.

Two members of Congress have asked for an investigation into the release, and 200 national security professionals signed a letter suggesting that the release may have been politically motivated.

Spanberger and Brat are running in a longtime GOP stronghold where President Trump’s unpopularity has made the race competitive. The Cook Political Report classifies the race as a “toss-up.”

Brat won the seat four years ago after beating then-House Majority Leader Eric Cantor in the GOP primary, a stunning upset fueled by an ascendant tea party. This year, Brat is contending with a strong challenge from Spanberger, anti-Trump sentiment and lingering resentment from Cantor supporters.