A US Navy warship commander who was ridiculed online for firing a rifle with the scope mounted backward has been relieved of duty, the Navy said Friday.

Cmdr. Cameron Yaste was the captain of the USS John S. McCain, a Navy destroyer that has been stationed in the Middle East since April.

“The commanding officer of USS John S. McCain was relieved Aug. 30 due to a loss of confidence in his ability to command the guided-missile destroyer,” the Navy said in a statement on the same day.

Yaste has been temporarily reassigned to Naval Surface Group Northwest, according to the Navy.

In April, the Navy posted a photo on its Instagram account of Yaste firing a rifle with its scope on backward. Yaste was mocked online for the gaffe and the photo was removed shortly after.