Just one day after announcing that Bath’s annual Memorial Day parade had been canceled for lack of funds, American Legion Smith-Tobey Post 21, the parade’s longtime sponsor, announced that the parade is back on.

Post Cmdr. Chris Gillespie said Tuesday evening that an anonymous donor will give the post the money it needs to organize the parade. Gillespie said the donor contacted him Tuesday and agreed to give $5,000.

“We as a family are very excited about this,” Gillespie said of the donation that will make the parade happen. “This year’s parade is going to be just as good if not better than last year’s parade.”

Smith-Tobey Post 21 notified the city this month that it would be unable to sponsor the 2015 Memorial Day parade because of “severe financial difficulties.”

The post sent the letter to the city after it reached a plea agreement with the Sagadahoc County District Attorney’s Office in which it pleaded guilty to a felony charge of conducting an illegal gambling operation. Assistant District Attorney Jon Liberman, who prosecuted the case, said the post paid out “hundreds of thousands of dollars” over several years to patrons who played on the post’s four video poker machines.

Under the plea agreement, the post was ordered to pay $18,000 in fines and court costs. That led to its decision not to organize this year’s Memorial Day parade.

Richard Regan, the lawyer representing the post, said there was no evidence that any one person benefited from the revenue generated by the gambling operation. In fact, he said, the post donated some of the money to various charitable causes in the Bath region.

Gillespie said the parade is now scheduled to begin at 10:30 Monday morning in front of the Legion hall on Congress Avenue, near Bath Middle School. It will proceed through the city’s downtown before ending at the Patten Free Library.

City Manager Bill Giroux confirmed in an email Tuesday evening that the Smith-Tobey post has received permission from his office to hold the parade.

“I approved the parade late today,” Giroux wrote. “It’s not surprising that once again this community pulled together and it’s great to see the American Legion leading the charge.”

City officials received a letter dated May 7 from Michael Frelk, the post adjutant, saying the post would not be able to sponsor the parade.

“The Post is experiencing severe financial difficulties and is currently in the process of an operational reorganization. We apologize if this withdrawal has caused any problems for the city,” Frelk wrote. “The Post’s Executive Committee is working very hard on this reorganization and once Post 21 has recovered and is back on track, we look forward to continuing our relationship with the city.”

Gillespie, a 20-year Navy veteran, said Tuesday that the post has sponsored the parade for more than 25 years.

It’s important for the parade to continue because it honors the men and women who have made sacrifices for their country, he said.

“This is what we do. It’s for our fallen comrades and for the sacrifices they have made,” Gillespie said. The Bath post has more than 330 members, making it one of the largest American Legion posts in Maine.

Bath is also home to Bath Iron Works, which builds ships for the Navy. The Navy maintains a presence in the city through its Supervisor of Shipbuilding office.

Gillespie said the anonymous donor used a third party to approach him with the offer Tuesday. The donor was explicit in saying he did not want to be identified, Gillepsie said.

“I am so grateful that somebody stepped up and did that (donation),” said Kimberly Brackett, a co-owner of Brackett’s Market in downtown Bath. “It’s the kickoff to the summer season. The parade is very important to the city. Bath loves its Memorial Day parade.”