A New Jersey man who made up a story about a homeless veteran helping out his then-girlfriend and used the tale to solicit $400,000 in online donations has been sentenced to prison.

A judge in Burlington County sentenced Mark D’Amico to five years in state prison on Friday.

D’Amico admitted concocting the feel-good tale in 2017 about Johnny Bobbitt Jr. giving $20 to help Katelyn McClure when her car ran out of gas in Philadelphia.

This November 2018 combination of photos provided by the Burlington County Prosecutors office shows Johnny Bobbitt, from left, Katelyn McClure and Mark D’Amico. A feel-good tale of Bobbitt, a homeless man using his last $20 to help Katelyn McClure, a stranded New Jersey woman, buy gas, was actually a complete lie, a prosecutor said Thursday, Nov. 15, 2018. A GoFundMe that was set up by McClure and her boyfriend D’Amico raised more than $400,000 to help Bobbitt. (Burlington County Prosecutors Office via AP)

Prosecutors say the three had met previously and cooked up the scheme.

McClure and Bobbitt also have pleaded guilty.

D’Amico also pleaded guilty to separate federal charges, and his sentences will run concurrently.