Some say cats have a sixth sense that alerts them to when a person may be in peril. Thomas Williams believes that.

Williams, 69, of Foxboro, who is an amputee, claims his orange-and-white tuxedo cat Garfield saved his remaining leg after it developed an infection in late October.

“He kept rubbing against my leg,” Williams said of the cat, which he adopted in February from a shelter on Cape Ann after searching for a pet online to keep him company.

Garfield became so persistent, at one point “he gave my leg a bear hug,” somewhat startling his owner.

“I thought, ‘This is strange,’” Williams said of his cat’s behavior.

He called a nurse and when she looked at his leg, she surmised he had an infection.

Williams said a doctor at Good Samaritan Hospital in Brockton told him upon examination that the infection might lead to the amputation of his remaining leg, “but he was able to save it.”

“He told me, ‘You better go home and thank your cat,’” Williams said, adding that, needless to say, Garfield “got more than a couple of treats.”

The lasagna-loving Garfield, who is about a year-and-four-months-old, is Williams’ constant companion. That’s why he got the cat in the first place.

“Living by myself, I was too lonely,” he said.

Garfield was in a shelter after suffering abuse and is blind in one eye, which were among the reasons Williams adopted him. The cat sleeps with him every night now.

“Takes up the whole bed,” Williams said with a chuckle.

But he doesn’t really have any complaints.

“He saved my life,” Williams said.