Prime Minister Kevin Rudd has announced that 50 Australian police will be sent to Papua New Guinea to help tackle crime, a day after armed soldiers attacked people at a hospital.

The attack at the Port Moresby General Hospital happened just hours before Mr Rudd arrived in the capital for talks with his PNG counterpart Peter O'Neill.

After the talks Mr Rudd said the Australian police officers would be deployed to the country by the end of the year.

"Recognising the importance of law and order to PNG's economic prosperity, we have agreed importantly that by year's end Australia will deploy 50 police in visible policing roles in Port Moresby and Lae," Mr Rudd said.

"Our law and order cooperation won't stop there, but it is a good start."

PNG recently passed harsh new laws reviving the death penalty as it grapples with a wave of violent crime.

In the latest incident, soldiers armed with guns, machetes and iron bars broke down the gates to the hospital and began attacking people.

Police commissioner Simon Kauba says at least six shots were fired, while a medical student was seriously injured and the hospital sustained considerable damage.

He has condemned the soldiers for attacking "the very people they have sworn to protect and defend".

"This is totally uncalled for and unacceptable behaviour by members of a disciplined organisation," he said in a statement.

"I condemn this action in the strongest possible terms and will ensure that it is thoroughly investigated and those responsible will face the full force of the law."

The attack was reportedly payback for an alleged assault by medical students on two soldiers during a dispute over the use of an ATM at the hospital.