Two Muslim men are suing the State of New York and the NYS Department of Corrections and Community Supervision for discrimination, claiming they were suspended by higher-ups at the Fishkill Correctional Facility for refusing to shave their beards on religious grounds.

Brian Sughrim and David Feliciano say they’ve worn beards without incident while working at the Hudson Valley lock-up for years, yet were suddenly told this month they must shave because their facial hair presents “an undue hardship and burden on facility operations,” according to their Manhattan federal court lawsuit filed Monday.

When they refused to shave, they were suspended on Aug. 10 and Aug. 15 — even though other non-religious officers at the facility have been allowed to keep their facial hair without incident.

Yet the men were suddenly reinstated Monday, according to a statement from the DOCCS.

“Given the recently signed legislation by Governor Cuomo, DOCCS has conducted a secondary review of the requested exemptions dealing with facial hair and has made the determination to grant the requests, reinstating both employees to their positions with full back pay,” spokesman Thomas Mailey said in a statement. “DOCCS will also be reviewing its rules regarding facial hair immediately in light of the new law.”

Mailey was referencing legislation Andrew Cuomo signed into law on Aug. 9, which prohibits employment discrimination based on religious attire, clothing or facial hair.

The spokesman denied the men were reinstated due to media inquiries Monday — even though the men were suspended after Aug. 9.

The change of heart was in part prompted by the lawsuit, according to a source with knowledge of the investigation.

A lawyer for Sughrim and Feliciano did not immediately respond to a request for comment.

Lawyer Joshua Moskovitz said he learned late Thursday that his clients would be reinstated first thing Tuesday morning.

“There is no question that their reinstatement was the result of our lawsuit,” he said.