Neil Patrick Harris has undergone surgery after getting an infection when he fell ''onto a sea urchin''.

The former 'How I Met Your Mother' actor has revealed how the accident on a trip to Croatia left him with two of the creature's spines stuck in his hand.

Taking to Instagram on Tuesday (15.10.19) after having them removed, he wrote: ''Had surgery today. I tripped and hand planted onto a sea urchin almost two months ago while climbing rocky cliffs in Croatia.

''Most of the tiny spines I dug out myself, but two refused to leave and one got infected. Turns out it pierced through a tendon...

''Well, thanks to the surgical talents of Dr. Dan Polatsch and his team, I'm officially urchin free and on the mend.

''Only drawback - having to wear this massive hand elevating contraption for the foreseeable future... All in all, though, I have to say: uni is still delicious.''

The 45-year-old actor has been married to David Burtka - with whom he has nine-year-old twins Harper and Gideon - since 2014, and he recently took to social media to wish his boy a happy birthday after they celebrated their special day on October 12.

Sharing before and after snaps of their sons as babies and now, he joked the duo make him ''feel inept'' and ''deeply proud''.

He said: ''Harper and Gideon are nine. NINE. It's remarkable to me how quickly they age, and how quickly they continue to make me feel inept. Deeply proud, no doubt. But also, inept. #grateful''

Meanwhile, Neil also revealed a week ago he had signed up for former 'Doctor Who' showrunner Russell T Davis' new drama 'Boys'.

Making an announcement on Instagram, he wrote: ''Proud to be a part of Russell T Davies' brave new series called Boys. This remarkable story speaks the resonant truths of young people's self discovery during a period when so many of these lives were cut short. Production starts soon. Can't wait.''