The Marine Corps said Wednesday it has decided to discharge a sergeant who was harshly critical of U.S. President Obama on Facebook.

Sgt. Gary Stein was singled out when he posted a message on Facebook in March: "Screw Obama. I will not follow all orders from him." Told he might have violated the Uniform Code of Justice, Stein quickly changed his comments to say he wouldn't follow unlawful orders from Obama, the commander-in-chief, Politico reported.

He also tried to make amends, saying he'd made a mistake.

But a statement from the Marine Corps Recruit Depot in San Diego said Stein is being given an other-than-honorable discharge for violating the Pentagon's rules limiting the speech of members of the armed forces.

Politico said Stein's lawyer unsuccessfully tried to get him off the hook by using the First Amendment to get a court injunction against the corps, but the less than honorable discharge removes Stein from the corps.

He had served in the corps for nearly a decade, Politico said, but now won't get any benefits.