Virginia’s inspector general has found that a deputy in the office of Attorney General Ken Cuccinelli II improperly collaborated with energy companies in a legal dispute over natural gas royalties in southwest Virginia, according to a report released Tuesday.

Inspector General Michael F.A. Morehart said that Sharon Pigeon, a senior assistant attorney general, “inappropriately” used state resources to assist the energy companies on legal strategy in a battle between landowners and coal companies over the extraction of natural gas from coal beds. Morehart’s findings were first reported by the Associated Press.

The long-running and complicated dispute, in which property owners have accused two out-of-state coal companies of withholding millions in gas royalties owed to them, has become a bitter issue in the Virginia governor’s race between Cuccinelli (R) and Democrat Terry McAuliffe.

McAuliffe’s campaign has pummeled Cuccinelli for his office’s intervention on behalf of the energy companies while highlighting the campaign contributions he has received from the industry. Cuccinelli has maintained that he has done nothing wrong and took steps to correct the situation after his deputy’s actions came to light.

Pigeon told the inspector general that she had intervened to defend a state law that dictates how disputes are to be settled between landowners and energy companies over natural gas extraction from coal beds, Morehart’s letter says.

But after reviewing dozens of e-mails, the inspector general found that Pigeon assisted energy companies directly, in some cases improperly, and continued to do so after a federal court had upheld the law in question, in September 2011. Morehart found that Pigeon’s assistance inappropriately extended to strategy that could benefit the companies in potential state litigation outside the federal court, the letter says.

In one exchange, the letter says, Pigeon advised the companies about a procedural maneuver that could allow them to seek the dismissal of a case.

The inspector general found that Pigeon’s superiors became aware of the e-mails sent to energy companies only after attorneys for landowners filed a motion in U.S. District Court seeking access to them. Court records show that plaintiffs filed legal papers at least as far back as May 2012 to obtain the e-mails.

The legal dispute — which involves perhaps hundreds of landowners and about $28 million in disputed royalties — pits property owners against two of Virginia’s largest producers of natural gas pumped from coal seams, known as coal-bed methane.

Until about 30 years ago, mining companies considered coal-bed methane a waste product. After new technology allowed them to extract the gas, questions arose over who was entitled to its royalties — the company that had obtained the right to mine the coal or the property owner.

Under state law, companies were allowed to extract the gas even in cases of disputed ownership as long as they also put aside a portion of royalties until the ownership was decided. But landowners say the companies and the state have ignored a series of court decisions that suggest they are the rightful owners of the gas. Landowners argue in court papers that EQT Production and CNX Gas, a unit of Consol Energy, at best handled the royalty payments sloppily and at worst shortchanged them.

The companies have denied any wrongdoing.

The dispute has led to accusations that Cuccinelli, who has stressed his advocacy for the plight of coal workers, has sided with energy companies at the expense of southwest Virginians. And it has given McAuliffe an opening to attract support in a part of the state that has voted heavily Republican in recent years, in part because of the Obama administration’s environmental policies.

“The Virginia Inspector General confirmed today what Virginians have found troubling for months — that Ken Cuccinelli’s office had stepped over the line and improperly used taxpayer funds to advise out-of-state energy companies trying to avoid paying Southwest Virginia landowners mining royalties that are rightfully theirs,” McAuliffe spokesman Josh Schwerin said in a written statement. Schwerin called on Cuccinelli to return campaign contributions from one of the energy companies.

Brian Gottstein, a spokesman for the attorney general’s office, said the report vindicates Cuccinelli.

“The inspector general’s report proves what we have said from the beginning: Attorney General Cuccinelli had no prior knowledge of the content of these emails and he did not authorize them,” Gottstein said in a written statement. “The innuendo and outright accusations by some that the attorney general was working against landowners have been proven to be patently false.”

Gottstein said Pigeon was ordered to have no further contact with the energy companies as soon as Cuccinelli learned of the collaboration — an order that was expanded last month to remove her from the case altogether.

The inspector general opened the investigation after news reports that a U.S. magistrate had expressed shock that Pigeon was assisting the energy companies. State Sen. Phillip P. Puckett (D-Russell) also called for an independent examination. Puckett said at the time that he was troubled because Consol Energy has contributed more than $111,000 to Cuccinelli’s gubernatorial campaign.

Morehart served as special agent in charge of the FBI’s Richmond field office before Gov. Robert F. McDonnell (R) appointed him to lead the newly created inspector general’s office.

Jennifer B. Jenkins contributed to this report.