A 30-year-old Brooklyn man will spend more than a decade behind bars after robbing two subway riders after he attacked them with a hammer, according to authorities.

Anthony Coward was sentenced Monday to 12 years in prison and five years post-release supervision after he plead guilty in January 2015 to two counts of first-degree robbery.

RELATED: Police continue to investigate hypodermic subway stabbing

According to prosecutors, Coward attacked the straphangers in separate incidents both taking place inside the Rockaway Avenue A/C subway station at the corner of Rockaway Avenue and Fulton Street in Brooklyn.

The first incident occurred on May 4, 2014 at about 11 a.m. when Cory Healy was buying a MetroCard from a vending machine, authorities said. Coward approached Healy from behind and hit him on the side of the head with a hammer. Healy fell to the floor and Coward demanded his property and continued to strike him with the hammer. He then fled with the victim’s wallet, MetroCard, debit card and $58 in cash.

Days later on May 7, 2014 at about 9:20 a.m. Coward approached Brijanand Rishianand while he was purchasing a MetroCard and hit him on the side of the head with a hammer, according to prosecutors. As he was bleeding Rishianand gave his attacker $140 and Coward then fled.

RELATED: Subway riders cautious after recent train slashings

Both victims suffered pain, bruising and swelling to the head, authorities said. The first victim also suffered bruising to the arm, and Rishianand suffered a concussion.

“In order for our city to be a place of law and order, people must be able to enter our subways without fear of being violently attacked. This defendant caused such fear by ambushing subway riders from behind, smashing them over their heads with a hammer and running off with their money,” said Brooklyn District Attorney Ken Thompson. “Without question, he now deserves to spend many years locked up in prison due to the extremely violent nature of his attacks."