(CNN) - Two national police officers were wounded Sunday when a gunman shot at officers outside the Italian prime minister's office, authorities said.
The gunman, described as a 49-year-old man, fired six shots at police before being taken into custody, said a national police officer who was not authorized to speak to the media.
The officers didn't suffer life-threatening wounds, and the shooter was also hospitalized -- though not wounded, the source said.
The gunman wanted to commit suicide after the attack but ran out of bullets, Italian Interior Minister Angelino Alfano said in a televised statement.
The shooting took place in front of the prime minister's office, but Enrico Letta was being sworn in as prime minister at the time at the president's palace a short distance away, state-run news agency ANSA said.
Security at key government buildings was strengthened after the attack, though officials said they thought it was an isolated incident.
The shooter, who is unemployed, lives in the southern region of Calabria, officials said.
On Saturday, Letta, a center-left politician, accepted a mandate to form a government from President Giorgio Napolitano.
The 46-year-old former deputy prime minister and his ministers were being sworn in Sunday, and parliament is expected to confirm his government through a vote of confidence Monday.
Letta's acceptance of the leadership role is expected to limit the uncertainty that has gripped the nation since February when elections left none of the candidates with enough support to form a government.