A row has erupted over comments the Prime Minister made as a man tried to throw himself over a railing in Parliament today.

There were gasps from MPs as the man, heard muttering about injustices, tried to launch himself from the public gallery into the debating chamber below.

As security guards, a solicitor and diplomatic protection squad officers tried to drag the man back over the bannister, Labour says John Key cried across the house "shame on Labour".

As the speaker shouted for silence, Labour MPs, including deputy leader Annette King, were spitting, calling out "scumbag" repeatedly towards the National benches.

Since the incident Labour leader Phil Goff has called Key stupid.

Goff said he was "stunned" at the man's episode.

"But then the Prime Minister started yelling across the House 'shame on the Labour Party, shame on the Labour Party', as though this was something that was instigated by the Labour Party.

"Clearly, it wasn't. That was a very stupid thing for him to say," Goff said.

"It was totally inappropriate behaviour for a guy that is the Prime Minister of New Zealand or for any member of the House.

"He was absolutely wrong. It's a disgrace that he would even make that allegation and I just hope that the election campaign is not going to be fought on that basis."

Wading into the war of words, senior Labour MP David Cunliffe said Key had tried to turn the incident into a political event.

"He said 'you should be ashamed of yourself, that's down to you guys', meaning Labour."

Cunliffe said the comment was inappropriate because the man might have been attempting to commit suicide.

"To turn that into a political event shows a personality trait that most people don't often see of the prime minister and it brought the House into disrepute.

"It's a very low point in the House."

But a spokeswoman for Key said Labour had the wrong end of the stick.

In a short email, they said: "The Prime Minister's comments following the incident were a reflection on the Labour

Party's continued criticism of his DPS security detail - which included criticism of his being accompanied inside the parliamentary complex. It should be noted a DPS member was involved in restraining the member of the public."

An ambulance was called to Parliament and a security officer who grabbed the man had to be taken to hospital with injuries to his ribs and ankle.

Parliamentary Service general manager Geoff Thorn said the officer had acted quickly and pulled the man off the barrier as he tried to jump.

"The security staff member was injured in the incident, but continued to restrain the man until assistance arrived very soon afterwards. The man was then handed to police," Thorn said.

Auckland solicitor Matthew Piper helped guards pull the man back over the railing.

"[He was] obviously trying to propel himself over onto Labour backbenchers at which point the security guards acted very quickly to come and grab him."

The man managed to get his whole body over the edge of the railing before he was pulled back by four or five people.

"He continued to struggle after he was pulled back over and was making kind of lots of noises about various injustices, no one could really understand."

The security guards did a good job of stopping him, Piper said.

The man was heard calling out about Work and Income, Key and Social Development Minister Paula Bennett.

Key looked visibly shaken and was escorted out of Parliament a short time later by his security detail.

Earthquake Recovery Minister Gerry Brownlee said security guards were on the scene "very, very quickly".

"He probably got half his body over. He had one leg over.

"He wasn't saying too much at that time but he certainly had a lot to say on the way out.

"[We were] shocked because you don't know why he was wanting to leap. When he went out he made a few statements that were fairly clear what he was about. I'd rather not go into that."