A man with an "urge" to eat metal swallowed 40 knives over a period of two months.

Doctors needed five hours to perform a mammoth operation to remove the knives from the man's stomach in the northern Indian city of Amritsar, CNN reported.

Surgeons said they found knives of up to seven inches in length, some folded, others not and some rusty.

"He had a wild urge to consume metal. Even for us, the experienced surgeons, it was frightening", one doctor told CNN.

"We were so nervous... a small mistake could have taken the patient's life. In my 20 years of practice, I have never seen anything like it".

Doctors took two days to come up with a surgical plan of action prior to operating.

The patient is now "out of danger" and is set to be discharged in a couple of days. Since the operation he has been referred to a psychiatrist.

The patient told doctors he had no idea why he started eating knives but that he "developed a taste for metal" and "loved the way blades tasted".