PORTLAND, Ore. (Reuters) - A federal court jury delivered a surprise verdict on Thursday acquitting anti-government militant leader Ammon Bundy and six followers of conspiracy charges stemming from their role in the armed takeover of a wildlife center in Oregon earlier this year.

The outcome marked a stinging defeat for federal prosecutors and law enforcement in a trial the defendants sought to turn into a pulpit for airing their opposition to U.S. government control over millions of acres of public lands in the West.

Bundy and others, including his brother and co-defendant Ryan Bundy, cast the 41-day occupation of the Malheur National Wildlife Refuge as a patriotic act of civil disobedience. Prosecutors called it a lawless scheme to seize federal property by force.

Jubilant supporters of the Bundys thronged the courthouse after the verdict, hailing the trial’s outcome as vindication of a political ideology that is profoundly distrustful of federal authority and challenges its legitimacy.

“We’re so grateful to the jurors who weren’t swayed by the nonsense that was going on,” defendant Shawna Cox told reporters. “God said we weren’t guilty. We weren’t guilty of anything.”

As the seven-week-long trial in the U.S. District Court in Portland climaxed, U.S. marshals wrestled to the floor Ammon Bundy’s lawyer, Marcus Mumford, as he argued heatedly with the judge over the terms of his client’s continued detention.

The Bundys still face assault, conspiracy and other charges from a separate armed standoff in 2014 at the Nevada ranch of their father, Cliven Bundy, triggered when federal agents seized his cattle for his failure to pay grazing fees for his use of public land.

Slideshow ( 14 images )

The outcome of the Oregon trial clearly shocked many in the packed courtroom. Attorneys exchanged looks of astonishment with the defendants, then hugged their clients as the not-guilty verdicts were read amid gasps from spectators.

Outside the courthouse, supporters celebrated by shouting “Hallelujah” and reading passages from the U.S. Constitution. One man rode his horse, named Lady Liberty, in front of the courthouse carrying an American flag.

The verdict came after four days of deliberations. One juror, a former federal employee, was dismissed over questions of bias on Wednesday and replaced by a substitute.

The 12-member panel found all seven defendants - six men and a woman - not guilty of the most serious charge, conspiracy to impede federal officers through intimidation, threats or force. That charge alone carried a maximum penalty of six years in prison.

The defendants also were acquitted of illegal possession of firearms in a federal facility and theft of government property, except in the case of Ryan Bundy, for whom jurors were deadlocked on the charge of theft.

The takeover of the wildlife refuge was initially sparked by outrage over the plight of two imprisoned Oregon ranchers the occupiers believed had been unfairly treated in an arson case. But the militants said they were also protesting larger grievances at what they saw as government tyranny.

Slideshow ( 14 images )

The standoff led to the shooting death of one protester, Robert “LaVoy” Finicum, by police shortly after the Bundy brothers were arrested, and left parts of the refuge badly damaged.

More than two dozen people, in all, have been criminally charged in the occupation, and a second group of defendants is due to stand trial in February.

Mumford told reporters he believed Ammon and Ryan Bundy would remain in custody for the time being but may be transferred to Nevada.

Four co-defendants were free on their own recognizance during the trial. A fifth, David Fry, the last of the occupiers to surrender in February, was released hours after the verdict.