A Long Island man competing in a military-style competition that bills itself as “the world’s toughest race’’ had to call it quits after nearly losing his leg, a lawsuit claims.

Christopher Jurs, 35, says his right knee was impaled by a jagged piece of metal hidden under a pool of sludge as he was sprinting through the “Electroshock Therapy’’ portion of a Tough Mudder race in Englishtown, NJ, in October 2013.

The obstacle — the final phase of the grueling 13-mile competition — involves running through a field of live wires dangling over mud trenches.

Instead of having to worry about just being painfully zapped, Jurs got a sharp piece of metal straight through the bone of his knee, causing a serious infection, his suit says.

Jurs, an East Northport resident and consultant for KPMG, was forced to undergo emergency surgery to treat the wound and missed two months of work, his Brooklyn Supreme Court suit says.

“This is a defect that no one could have ever imagined. You can’t assume a risk like that,” said his lawyer, Zandra D’Ambrosio.

A rep for the Brooklyn-based Tough Mudder company said safety is its “top priority.”

Click for more from the New York Post.