RICHMOND — Virginia’s inspector general is investigating allegations that a senior lawyer in the attorney general’s office improperly sided with out-of-state energy companies over residents in a dispute over mineral rights.

State Inspector General Michael F. A. Morehart confirmed on Tuesday that the inquiry has been underway for several weeks. He noted that the investigation focuses on one of Attorney General Ken Cuccinelli II’s staffers, not Cuccinelli, the GOP candidate for governor.

“Our legislation prohibits my office from looking at the attorney general or any elected official but for a request from the attorney general, or governor, or a grand jury,” he said. “I couldn’t look at the AG if I wanted to.”

The investigation stems from a legal dispute between energy companies and landowners over which of them owns the rights to methane gas pumped from coal seams. Methane produced during mining operations used to be vented into the atmosphere, but advances in technology now allow that to be captured. Landowners who sold the rights to coal on their property before that technology was developed say they own the rights to the methane, while the companies say those rights belong to them.

The matter has been an issue in the governor’s race since June, when a federal magistrate judge analyzing whether the dispute should be turned into a class-action lawsuit wrote that Senior Assistant Attorney General Sharon M.B. Pigeon had been “shockingly” involved in assisting the energy companies with their defense.

One of the companies is part of a corporation that has given more than $111,000 to Cuccinelli’s gubernatorial campaign since 2010.

Cuccinelli’s office was not a party to the suit. The attorney general said at the time that Pigeon communicated with company lawyers about the state’s Gas and Oil Act, which the companies are using in their defense and the commonwealth has an interest in protecting as existing state law.

Several Democratic lawmakers urged Cuccinelli in June to seek an investigation of his office by the state inspector general. This week, the Bristol Herald Courier reported Morehart was investigating. Morehart declined to say if his inquiry was prompted by the calls from Democrats, but he said he was not obligated to investigate something just because a legislator refers it to him.

“It’s not an automatic thing,” he said. “It’s my judgment.”

Cuccinelli declined to discuss the matter when reporters brought it up after a Tuesday event in Richmond, where he unveiled his K-12 education plan. He said he wanted to stay positive and focused on education for the day.

“If you have other topics, today you’ve got to ask those of people like Richard,” he said, referring to spokesman Richard Cullen. “Call tomorrow and we’ll talk about something other than education.”

Shortly afterward, Cullen e-mailed a statement from Cuccinelli: “We’re glad the Inspector General’s Office has been looking into this case because they’re going to find that our office acted appropriately. We’ve been cooperating with the IG at every step of the way. One of the main functions of the attorney general’s office is to defend Virginia statutes from legal challenges and that’s exactly what we we’ve done in that case.”

Democrats trumpeted news of the investigation and posted video of Cuccinelli walking away from reporters on YouTube. “Video: Cuccinelli Refuses to Take Questions about Investigation into His Gas Scandal,” the Democratic Party of Virginia announced.

“News today that the Inspector General is investigating Ken Cuccinelli for his role in helping out-of-state energy companies against Virginia landowners is confirmation of a disturbing trend in the Attorney General’s office,” said Terry McAuliffe, Cuccinelli’s Democratic rival. “A federal judge already said that she was ‘shocked’ at the conduct of the Attorney General’s office in this case.”