ROME - Italy's new government was sworn in Sunday, ending weeks of political stalemate, but the ceremony was overshadowed by a shooting outside the prime minister's office.

Two policemen were injured outside Palazzo Chigi when six shots were fired as the swearing-in ceremony was held at the nearby presidential palace, news reports said.

The suspect, identified as a 49-year-old Italian man with no criminal record, was captured. A pregnant passer-by was grazed by a stray bullet.

The gunfire sparked panic in central Rome and prompted the evacuation of the area outside the Quirinale Palace, where the new Cabinet members were taking their oaths of office.

Investigators described the shooting as an act of despair by an unemployed, divorced man and said he had intended to kill the police officers deployed in front of the seat of the government.

A short time later, the Cabinet held its first meeting. The new government, formed by a left-right coalition, faces a parliamentary vote of confidence in the lower house of Parliament and the Senate.

The votes would close the book on the political deadlock in the eurozone's third-largest economy since February's inconclusive general election.

The 21 members of the new Cabinet come from across the political spectrum.