David Porter, of 22 Myrtle Ave., Webster, was ordered held on $5,000 bail in Dudley District Court Monday on a charge of unarmed robbery. A plea of not guilty was entered on Mr. Porter’s behalf and his pretrial hearing was set for March 1. He was ordered to stay away from the bank.

Authorities got a call reporting a holdup alarm at the bank, at 257 Main St., about 10:30 a.m. Saturday, according to a police report by Detective Sgt. Carlos Dingui. Police were told a man had held up the bank, leaving with money.

About 5 p.m. Sunday, Mr. Porter, accompanied by his two sisters, turned himself in and confessed.

She had taken most of his money from his check to pay the monthly rent, leaving him without enough to buy drugs.

Meanwhile, his dealers were demanding to be paid the about $1,400 he owed them, and Mr. Porter was afraid they would go to his home, which he shares with his girlfriend and 2-year-old child.

Mr. Porter told his girlfriend he was going out to try to borrow money from friends. He left with her car.

He drove to a liquor store in Auburn and bought alcohol and scratch tickets.

When he did not win money on the ticket, he grew more frustrated because he had used his last $10.

He decided to drive to Southbridge to rob a bank. He told police he thought he lived far enough away from Southbridge that no one would recognize him.

Mr. Porter said he had visited Southbridge in the past and was familiar with the bank, which he circled to make sure the area was clear.

He then parked in the upper rear lot. With his hood over his head, he entered the bank from the rear entrance. He went to a counter toward the front of the bank and wrote “give me all your money” on a deposit slip.

There was no line, so Mr. Porter went to the nearest teller and handed her the note. She looked at it in shock and gave him the money.

Mr. Porter then walked out the same rear entrance, got into his car, drove home and stashed the money in his garage.

Later, he used the money to buy a meal at McDonald’s for his family, pay off his drug debts and buy more drugs.

That night he threw away the bank tags used to hold the money and the sneakers he wore during the robbery.

He told police he was wearing the same black sweater and jacket he wore during the robbery. Investigators seized the clothes as evidence.

When asked why he had turned himself in, Mr. Porter said he and his girlfriend had received several phone calls from friends saying the picture of the suspect published in media outlets looked like him.

Mr. Porter said he thought about the incident all day while at work for Custom Beverage Service in West Boylston.

While at a job site in Boston, he said, he saw his face on the front page of a newspaper.

He said he “broke down” and told his boss, who proceeded to fire him.

Mr. Porter said he spoke with his sisters, who made arrangements for him to turn himself in.

Police said that with the help of the bank manager, they got a clear surveillance photograph of the suspect’s face, which was given to several traditional media outlets as well as posted on social media websites.

Police said a tipster told them she attended school with Mr. Porter at Bay Path Regional Vocational High School in Charlton.