An Oregon sheriff testified that he received death threats and feared for his small rural community when a national wildlife refuge was taken over by an armed cowboy militia, led by brother ranchers Ammon and Ryan Bundy.

Haney County Sheriff David Ward's testimony in a Portland federal courthouse was the first in the trial against the Bundy brothers and five other defendants. They are facing charges of impeding federal officers with force, intimidation or threats.

The Bundy militia took over the Malheur National Wildlife Refuge in January to protest against federal ownership of public pasture lands, which they believe should be turned over to ranchers.

The occupation lasted 41 days and ended after Oregon state police shot dead militia member LaVoy Finicum.

Ward testified that the community is "still dealing with the fallout" of the tense, drawn-out standoff. After he told reporters during the takeover that the militia was bent on overthrowing the government, he and his family received anonymous death threats.

But he testified that he was never personally threatened by Ammon Bundy, nor did he fear for his own life, but he did worry about his community, reported Oregon Public Broadcasting.

"The threat I perceived was that they would bring people to town and try to overpower or overthrow my authority as sheriff," Ward tesitified.

Ward said what he had read about an earlier standoff with federal agents in Nevada by the Bundy brothers and their father, Cliven, in 2014, again over pasture rights, frightened him. "The thought of that happening in my community scared the hell out of me," he testified.

The prosecution presented emails from defendant Neil Wampler to Ward. They included one that said if the sheriff did not support other protesting ranchers facing jail for setting fires on federal land the area would be "invaded by some of the most determined and organised – and armed – citizens alive in this country today." Another of the emails, sent in 2015, simply warned: "We ain't playin'."

Brian Needham, a lieutenant in the sheriff's office, also testified that one of the occupation leaders, Ryan Payne, told him in a meeting that he should consider killing Ward and replacing him. Payne allegedly told him he "should use any means necessary" to remove Ward, "including death".

During cross-examination, Marcus Mumford, Ammon Bundy's attorney, repeatedly asked Ward if he believed the federal government had the authority to regulate public land in Oregon.

The exasperated cop finally responded: "There's 200 years of case law that shows that they can own land."

The government has charged 26 people, though 11 have negotiated plea deals.