A judge on Monday reinstated the ousted director of the Philadelphia Department of Veterans Affairs benefits office, the latest turn in what has been nearly constant scrutiny of the beleaguered office.

In a 59-page decision, William L. Boulden, a judge of the Merit Systems Protection Board, said he agreed with VA officials that Diana Rubens showed poor judgment two years ago by helping facilitate the reassignment of her predecessor and then taking his job. But Boulden said the demotion and pay cut ordered by Rubens' bosses at the VA was excessive, noting that the agency failed to punish another official involved in the transfer.

"I find that there is a significant problem created by the inconsistent treatment of a comparable employee, and that this makes the penalty unreasonable under the circumstances," he wrote.

Boulden, whose board hears government employee appeals, did not absolve Rubens of wrongdoing, but said the law did not give him the option of imposing a lesser punishment. He ordered the agency to cancel its attempts to reassign and demote Rubens within 20 days, and give her back pay, interest, and benefits.

A VA spokesman did not respond when asked Monday when Rubens would resume her job. Rubens and her attorney also did not respond to a request for comment.

The ruling was a major victory for Rubens, who has been repeatedly assailed by critics in Congress and veterans' advocacy groups. It follows a two-day hearing last week in which she spoke publicly for the first time in months, contending that she had unfairly been made a scapegoat for the agency's larger problems.

Her punishment stemmed from her 2014 transfer from a senior post in Washington to the director's job in Philadelphia, which officials said came after she helped coordinate the reassignment of the previous director. Officials said Rubens wanted the Philadelphia position, which came with the same $181,000 salary but less responsibility, because it would let her be closer to family in Delaware.

After the government spent $274,000 to relocate her from Virginia to Havertown, Rubens and her transfer drew intense scrutiny from the agency's inspector general and members of Congress.

In defiant and at times tearful testimony last week, Rubens told the judge she had been a victim of political attacks orchestrated by House Republicans intent on vilifying the VA and its leaders. She said her involvement in the transfer of the former Philadelphia director was administrative at best.

During their own testimony, VA officials generally praised Rubens' performance in the Philadelphia office, which serves 825,000 veterans across several states and had been deemed one of their most flawed.

In deciding to demote Rubens, transfer her to Houston, and cut her salary by nearly a third, VA Deputy Secretary Sloan Gibson said Rubens had created the appearance of a conflict of interest by not recusing herself in her predecessor's transfer. He called it a lapse in judgment.

The judge's opinion largely recounted the case and the legality of the punishment.

He agreed that there was nothing unlawful about Rubens' reassignment and that "most of the clouds hanging" over the move to Philadelphia "faded away like a mirage upon close scrutiny." But Boulden wrote that he nevertheless thought Rubens should have "recused herself from all involvement" in the reassignment of her predecessor and that she "created the appearance of impropriety" by not doing so.

He said he did not agree that Gibson, in making his decision, had been influenced by outside pressures, as Rubens and her attorney argued.

Boulden's ruling mirrored one in an identical case late last week. In that appeal, a Chicago merit board judge reversed the VA's attempts to demote and relocate another top official, Kimberly Graves, who was accused at the same time as Rubens of arranging her own relocation to the director's job in St. Paul, Minn.

Rather than clearing Graves of wrongdoing, the judge ruled that her punishment was excessive because officials had failed to discipline another top official involved in the transfers. In that case, the judge said the other official "failed to exercise sound judgment as much, if not more, because of his higher position."

U.S. Rep. Jeff Miller (R., Fla.), chairman of the House VA Committee and one of the lawmakers who has called for Rubens and Graves to be fired, used the two decisions to again lambaste the agency.

In a statement Tuesday, Miller said the cases are "irrefutable proof" the VA "isn't consistently and fairly holding employees accountable."

215-854-2730 @TriciaNadolny