WARNING: GRAPHIC PHOTOS BELOW

A lifelong nail-biter learned to stop the habit the hard way after he developed a serious infection that nearly cost him his finger.

Steven MacDonald, from Scotland, told South West News Service (SWNS), a British news agency, that he required emergency surgery after developing a green, pus-filled infection in his left index finger that was tied to “nibbling away” at his fingernails.

MORE THAN 2,000 POUNDS OF GROUND BEEF RECALLED OVER PLASTIC CONTAMINATION CONCERNS

MacDonald first noticed the infection when his finger became “red and itchy.” Soon after, he experienced swelling, puss, and underlying green color. The 48-year-old’s fiance, Karen Peat, encouraged him to go to a local pharmacy to seek treatment. A pharmacist reportedly recommended the man try magnesium sulfate to clear the infection, but MacDonald said he didn’t have any luck.

A few days later, MacDonald woke to a “rash all up on [his] arm.” The infection was beginning to spread, he said.

Peat then rushed MacDonald to a nearby emergency room. After they arrived, the man said everything was a “blur.” He was diagnosed with a severe case of paronychia, or the infection of the skin around the nail, and was told he required emergency surgery to remove the affected flesh.

''I could tell Karen was really anxious but I wanted to stay positive,” he said. “Looking back now, I didn't realize how serious it was.''

MacDonald was immediately taken into surgery and doctors worked for two hours to remove the infected skin on his finger. They also removed his nail, which MacDonald claims may never grow back. He remained in the hospital for a few days following surgery.

''This ordeal has taught me a huge lesson. To any nail biters out there, please just pull your finger away from your teeth,” he said. ''I've been tempted to bite a few times since, as it's been a habit of mine for so long, over 50 years, but I've told myself not to.”

CLICK HERE TO SIGN UP FOR THE FOX HEALTH NEWSLETTER

''At first, we weren't that worried as he'd had little swellings before where he'd been nail-biting, but when it kept getting worse and he showed me the rash, I really started to panic,” recalled Peat.

''It was horrible to hear, I was so scared,” she continued. ''I've told him he's never biting his nails again, it's just not worth it.''