Angry antigovernment protests by military leaders and unauthorized troop movements through the streets of several Spanish cities following the terrorist murder of a top Spanish general have created uneasiness here about divisions in the armed forces and about the intentions of some military leaders.

King Juan Carlos, commander in chief of the armed forces, admitted the troublesome divisions in a speech today to the country's top commanders during a celebration of the annual military holiday.

While he praised the military for their devotion and for their support of the transition to democracy, the king, who just turned 41, decried the "spectacle" of high officers shouting antigovernment and antidemocracy slogans at the funeral Thursday of Maj. Gen. Constantino Ortin, 63, Madrid's military governor, and said the incident was "shameful."

Gen. Ortin, a civil war veteran, was killed Wednesday by Basque separatist terrorists outside his Madrid apartment house.

Government supporters fear that mounting military pressure for strong action to deal with the terrorism, which claimed 99 lives in 1978 and five so far this year, could affect the outcome of elections scheduled for March by provoking a turn to the right among Spaniards still haunted by the terrors of the 1936-39 civil war.

Western diplomats discounted rumors that a putsch by the disgruntled military leaders was in the offing, but admitted that they had received many telephone inquiries about the military activity.

The government announced last night it was investigating the incident at the funeral and would punish all officers, whatever their rank, who shouted "inadmissible" insults against the government and in particular against Defense Minister Manuel Gutierrez Mellado, a retired lieutemant general.

An undetermined number of officers, including generals and lieutenant colonels, reportedly were involved in the incidents at Ortin's funeral. The officers reportedly shouted political slogans evoking the memory of the late dictator Francisco Franco.

[Reuter reported that a member of Spain's parliamentary Civil Guard, Antonio Ramirez Gallardo, and a woman companion were killed by machine-gun fire as they left a night club last night in the Basque city of Beasain.]

The depth of the military unrest was demonstrated Friday by army troop detachments that went on patrol in suburbs of Madrid and in cities in the provinces of Badajoz, Huelva, Toledo and Cordoba.

Army patrols have not been deployed on city streets in years, and official sources said the patrols were not authorized.