A U.S. diplomatic convoy came under attack on Monday in Sudan’s capital, Khartoum, Secretary of State Antony J. Blinken said, the same day that the European Union’s ambassador to the African nation was attacked, a sign of the deteriorating security situation.

“All of our people are safe,” Mr. Blinken said at a news conference on Tuesday in Karuizawa, Japan, where he was attending a Group of 7 meeting. Mr. Blinken said that the attack was still under investigation but that initial reports indicated that the assailants might have been tied to the Rapid Support Forces, the paramilitary group battling Sudan’s Army in clashes that began on Saturday.

“We will continue to track this very closely and very carefully,” Mr. Blinken said.

He said the U.S. convoy had diplomatic license plates and bore American flags, clearly identifying it.

The convoy was carrying American officials from their homes in the city to a large American residential compound in central Khartoum, said four diplomatic officials, who asked not to be named because of security concerns. Gunfire hit an armored vehicle in the convoy, but none of its occupants were injured, the officials said.

The compound, known as the presidential villas, was built under President Omar Hassan al-Bashir to house visiting heads of state during the 2006 Arab League Summit. The heavily guarded premises are about a mile and a half from the Sudanese military headquarters, which has experienced some of the fiercest fighting in recent days.

Across Sudan, people were hiding in their homes, fearing for their safety, as fighting entered a fourth day, with fighter jets circling the capital and gunshots and explosions rocking Khartoum. The violence against foreign officials, who are usually not targeted, highlighted how much the security situation has worsened in Khartoum in recent days.

On Monday afternoon, members of the R.S.F. assaulted the European Union’s ambassador to Sudan, Aidan O’Hara, in his residence in Khartoum, according to two Western officials. The bloc’s top diplomat, Josep Borrell Fontelles, said on Twitter that the assault constituted “a gross violation of the Vienna Convention.”

Mr. O’Hara, who is from Ireland, was not injured when armed men broke in, threatened him at gunpoint and stole money, the officials said. The assailants were identified by their uniforms and because the group controlled the nearby streets, the officials said.