MADRID — The running of the bulls this week in Pamplona, Spain, has produced its usual share of drama, including the goring of two Americans and one Briton on Tuesday.

But the controversy surrounding one of Spain’s most famous annual events has for once not focused exclusively on the dangers of dodging bulls hurtling down streets, but rather on the Basque flag that has been flying for the first time from Pamplona’s City Hall.

The red, green and white flag also made an appearance on the city’s streets, as revelers used the symbol to show their support for the independence of the Basque Country, which could also include the Spanish region of Navarre, whose capital is Pamplona.

The controversy comes at a time when Spain is experiencing a number of instances in which flags have been seized on for their powerful messaging. It also coincides with the cultural and political upheaval in the United States over the Confederate battle flag, which has long been contentious but was targeted as a visible symbol of intolerance last month after the massacre of black worshipers at a church in Charleston, S.C., and the arrest of a suspect with white supremacist ties.

The Basque flag, known as the Ikurriña, was raised by Joseba Asirón, who took office as mayor after Spain’s municipal elections in May. Mr. Asirón represents Euskal Herria Bildu, a radical political coalition pushing for the Basque Country’s independence.

The central government in Madrid contends that the decision to hoist the flag violates Navarre’s own laws, and it has started legal action.

Mariano Rajoy, Spain’s prime minister, said in an interview with Telecinco, a Spanish television channel, that flying the flag also showed that there were “some people” whose goal was to “take over Navarre and a part of France” — a reference to the fact that the Basque Country extends across the French border.

Spain has a history of separatist movements, and tensions have flared recently on several fronts, especially between Mr. Rajoy’s government in Madrid and the regional government of Catalonia, which has been pushing to secede from Spain.

The Catalan movement has had its own flag controversy over what people can fly and when.

The governing body of European soccer, UEFA, is set to decide this month whether to fine the Barcelona club, or even force it to play some matches behind closed doors, after its fans waved pro-independence Catalan flags during their team’s Champions League victory in Berlin last month. UEFA rules prohibit flags that are considered to have “messages of a political, ideological, religious, offensive and provocative nature.”

At the same time, Spain’s national flag is also under scrutiny. It has just been granted additional protection as part of a public safety law that took effect July 1 and allows the police to impose fines of as much as 30,000 euros, or about $33,000, for “offenses or insults” to Spain and its symbols, starting with its flag.

But as Spain prepares for a general election this year, its national flag has emerged as a potent symbol: Pedro Sánchez, the Socialist challenger to Mr. Rajoy, used it as the backdrop for his first campaign speech.

Marian Ahumada Ruiz, a professor of constitutional law at the Autonomous University of Madrid, said the Spanish flag “has historically proved a problem because of the way it was appropriated and politicized” during the Spanish Civil War and the subsequent dictatorship of Francisco Franco. Since then, she said, Spain’s flag has mostly been promoted by conservative politicians.

In turn, she said, Basques and Catalans turned their flags not only into symbols of their own identities but also into acts of defiance against the Franco government.

Mr. Sánchez suggested that he had embraced Spain’s flag to extend its national symbolism to the Socialists, as well. He added that it “represents a lot of the good things” that the Socialists have contributed to Spain.

José María de Areilza, a professor of law at the Esade business school, said Spain’s relative youth as a democracy has meant it has had little time “to make symbols coexist, particularly at a time of economic and institutional crisis.”

At the same time, he said, “a crisis like the one we’ve been through certainly makes people think again about their identity and where they live, and flags form part of that rethink.”

In Madrid, too, a flag was recently embraced as a symbol of change when its city hall displayed for the first time a giant rainbow-colored flag to coincide with gay pride events last week. Hanging the flag was among the first decisions of the new mayor, Manuela Carmena, a far-left politician who ousted Madrid’s conservative administration in May’s municipal elections.

In Pamplona, Mr. Asirón, the mayor, continues to defend his addition of the Basque flag to the four others at city hall: those of Pamplona, Navarre, Spain and the European Union. He told reporters that the flag had been raised out of respect to Basque lawmakers who were visiting.

The Basque flag, he said, “is a reflection of the pluralism within the society of Pamplona, nothing more.”