CARACAS, Venezuela — Seven Venezuelan military officers were killed on Saturday when their helicopter crashed while heading to a state where President Nicolás Maduro appeared alongside troops, days after the political opposition had called in vain for a military uprising.

The helicopter hurtled into a mountain outside Caracas in the early hours of an overcast day. An investigation was underway.

The armed forces said in a statement that the copter was heading to San Carlos in Cojedes State, where Mr. Maduro appeared on Saturday at a military academy to oversee training exercises. It was an effort to demonstrate the armed forces’ loyalty to him after a small group of security forces turned against him earlier in the week in the failed attempt by the opposition leader, Juan Guaidó, to overthrow the government.

On board the helicopter were two lieutenant colonels as well as five lower-ranking officers. The statement did not say if the copter was part of the presidential delegation.