By Steve Gorman

(Reuters) - A Utah militia commander with ties to renegade ranchers who were in the forefront of two armed standoffs with U.S. authorities has been arrested and charged with trying to bomb a government-owned cabin in Arizona, federal prosecutors said.

William Keebler, described by authorities as leader of a group called the Patriots Defense Force, based in Stockton, Utah, appeared in court in Salt Lake City on Thursday to face a charge of attempted damage to federal property by means of fire or explosive.

He was appointed a lawyer, and the judge set a detention hearing for June 29.

According to the criminal complaint filed against him on Wednesday, Keebler's group was infiltrated for several months by undercover FBI employees who had face-to-face and telephone contact with him and took part in his militia "field training exercises."

The charging document said Keebler, 57, also had ties with two high-profile figures in the anti-government militia movement - Nevada rancher Cliven Bundy and Arizona cattleman Robert "LaVoy" Finicum.

Bundy and 18 others have been indicted on felony charges stemming from a 2014 confrontation at his ranch between armed protesters and federal agents trying to seize his cattle in a dispute over federal grazing rights.

Prosecutors say Keebler was present during that clash. They also described him as an associate of Finicum, who was shot to death by law enforcement officers after taking part with Bundy's two sons in a separate armed occupation of a federal wildlife refuge in Oregon earlier this year.

In both instances, militia members and supporters said they were protesting what they viewed as government tyranny in its control of vast tracts of federal land in the western United States.

Federal prosecutors said FBI undercover operatives followed Keebler as he devised a plan to strike back at the government by blowing up a remote cabin on property of the U.S. Bureau of Land Management at Mount Trumbull in northwestern Arizona.

Keebler had previously scouted out that property with Finicum in October 2015, prosecutors said.

As described in the criminal complaint, Keebler ultimately arranged to detonate a remote-controlled bomb furnished at his request by an undercover operative. But when the bomb was planted outside the cabin door on Tuesday of this week and Keebler pushed the detonator button, the explosives proved to be inert.

Keebler then returned to Utah, where FBI agents arrested him on Wednesday morning, prosecutors said.

(By Steve Gorman; Editing by Simon Cameron-Moore)