Before being arrested by the FBI last week, three alleged members of a white supremacist group were plotting deadly attacks at Monday’s gun rights rally in Richmond, including shooting “unsuspecting civilians and police officers” in hopes of igniting what one called a “full-blown civil war,” authorities said in court filings.

In legal motions filed Tuesday in U.S. District Court in Maryland, prosecutors said the three suspects, who were under investigation for weeks before the rally, were recorded discussing the planned mayhem by a microphone and video camera secretly planted in a Delaware apartment by FBI agents in December.

“We can’t let Virginia go to waste, we just can’t,” one of the men, Patrik J. Mathews, said, according to the court filings. Like his co-defendants, Mathews is accused of belonging to a militant hate group whose name, “the Base,” is a rough English translation of “al-Qaeda.”

Mathews, according to prosecutors, said: “Here’s the thing. . . . You want to create . . . instability while the Virginia situation is happening . . . derail some rail lines . . . shut down the highways” as a way to “kick off the economic collapse.”

“Virginia will be our day,” another of the three, Brian M. Lemley Jr., said, according to the court documents.

In a search of the apartment, prosecutors said in writing, FBI agents “located Base propaganda fliers, communications devices, and empty rifle cases. In a common area closet, ‘go bags’ were found, which contained numerous Meals-Ready-to-Eat . . . and knives, and certain necessary items to build an assault rifle.”

On Mathews’s computer, agents “found several videos of Mathews espousing violent, anti-Semitic, and racist language,” according to the court motions. “Many of the videos discuss killing people in furtherance of ‘the movement.’ ” Lemley and the third man, William G. Bilbrough IV, also used gun parts “to make a functioning assault rifle” and had been practicing shooting at gun ranges before their arrests, authorities said.

At the Richmond rally on Martin Luther King Jr. Day, thousands of heavily armed gun-rights activists protested plans by Virginia’s Democratic governor and Democratic-controlled legislature to enact new gun-control measures. The hours-long gathering near the Virginia Capitol unfolded peacefully amid tight security.

Mathews, 27, Lemley, 33, and Bilbrough, 19, were together in December at an apartment that Mathews and Lemley shared in Newark, Del., prosecutors said in the court filings, asking a judge to keep the men jailed pending further proceedings. A hearing on the request is set for Wednesday in federal court in Greenbelt, Md.

The three are charged with federal firearms violations. Lemley and Bilbrough also are charged with transporting and harboring an illegal alien, referring to Mathews, who entered the country from Canada.

Defense attorneys have not filed a reply to the motions federal prosecutors submitted Tuesday. Attorneys for the three men could not immediately be reached for comment.

On Dec. 13, after obtaining a “sneak-and-peek” search warrant, FBI agents secretly planted eavesdropping devices in the apartment, according to court documents.

According to the court filings, “Lemley discussed using a thermal imaging scope affixed to his rifle to conduct ambush attacks” at the Richmond rally, allegedly stating, “I literally need, I need to claim my first victim. . . . It’s so unfair what I can do to people with that.”

Mathews allegedly replied that “tons of guys” at the Richmond gathering “should be radicalized enough to know that all you gotta do is start making things go wrong” and the rally can spiral into “full-blown civil war.”

“We could essentially be like literally hunting people,” Matthews said, according to prosecutors.

As for killing police officers, “If there’s like a PoPo cruiser parked on the street and he doesn’t have backup, I can execute him at a whim and just take his stuff,” Lemley allegedly said.

According to law enforcement officials, the Base emerged in recent years with aspirations of uniting various hate groups for a race war. The group encourages violence against African Americans and Jews and organizes military-style training, including a session in Georgia that Lemley, Bilbrough and Mathews allegedly attended in November, according to court documents.

Police in Georgia on Friday said they had also arrested and charged three members of the Base. One of the men confided to an undercover FBI employee about a plan to kill two anti-fascist activists, according to a police affidavit, and he allegedly contemplated forming a side organization to commit murders.

A man federal authorities said was a Base member out of Wisconsin was also recently arrested in connection with vandalizing a synagogue.

Rachel Weiner and Matt Zapotosky contributed to this report.