Neil Patrick Harris and David Burtka once had sex on a train.

The 45-year-old actor has been married to David - with whom he has eight-year-old twins Harper and Gideon - since 2014, and has admitted the ''naughtiest'' place they've ever had sex has been ''in the washroom'' of a European train.

Neil and David made the comments as they appeared on SiriusXM Hits 1 for a joint interview, after they were asked by the Jonas Brothers - who appeared on the show last week - to dish the dirt on the most outlandish place they've had sex.

'How I Met Your Mother' star Neil said: ''I am so excited that the Jonas Brothers asked us this question. The naughtiest place we've sh***ed? I would probably say on a train. A European train. In the washroom of a train. It was hot.''

To which David added: ''We were actually going from somewhere in Europe. I think it was from Rome to, I don't know.''

And Neil replied: ''I wasn't looking out the window if you know what I mean.''

But the train isn't the only place the couple have gotten down and dirty, as 44-year-old David had a different answer to the question, which saw them shedding their clothes out in the open.

He said: ''My naughtiest place I can remember is that we were on a cliff on the beach in Spain and there were all these boats in the harbour and we were just up there doing our thing. Putting on a show!''

The raunchy confession comes after Neil recently admitted he came out publicly in 2006 because it felt ''disrespectful'' to David not to speak about his sexuality.

He said: ''I wasn't trying not to reveal myself. I just thought, as an actor, you need to have the opportunity to be seen as a bunch of different things without a potential bias from someone else.

''I do magic, and magicians as well don't want anyone to know anything about them. And so I didn't deny anything at all.

''But then I was dating my now-husband and I realised it was most disrespectful to him to go in the car to an opening of a movie, and then I would go down the carpet and he would go with our publicist, behind where the camera guys were, and we'd meet up at the end. And it just felt disrespectful.

''All that said, though, I don't think that anyone should be told when anything is supposed to happen.''