President Barack Obama and Argentine President Mauricio Macri visit Parque de la Memoria in Buenos Aires, Argentina, Thursday, March 24, 2016. Obama visited the memorial to victims of the country’s murderous US-backed dictatorship who were killed or went missing from 1976-1983. (Pablo Martinez Monsivais/AP)

President Obama paid homage Thursday to the victims of a military regime that came to power 40 years ago, initially with the support of the United States.

A coup on March 24, 1976, intensified a dark period in Argentina’s history known as the “Dirty War,” during which the ruling military junta targeted leftists it viewed as an ideological threat. The Argentine government estimates that 13,000 people were killed or “disappeared” — abducted and never heard from again — during that period. Some independent groups put the number as high as 30,000.

Even the start of the war is a subject of dispute: Many historians say it began two years before under Isabel Perón, when paramilitary groups began assassinating dissidents.

Many Argentines have expressed dismay that Obama’s visit to their country coincides with the coup anniversary. But the president sought to use the moment to put to rest a fraught chapter of the U.S. legacy in Latin America.

[Obama, in Argentina, rejects calls for change in strategy against Islamic State]

Thousands of people marched in Buenos Aires on March 24 to mark 40 years since the start of a military dictatorship in Argentina. President Obama was visiting Argentina during the anniversary and said the U.S. was too slow to condemn the human rights atrocities. (Reuters)

Obama joined Argentine President Mauricio Macri at the Parque de la Memoria, or Remembrance Park, which features a long, gray stone wall with the names and ages of 9,000 of the junta’s victims — and space for many more — along the Rio de la Plata. The two leaders walked along the wall and onto a bridgehead, where they each tossed three white roses into the river. They then stood for a moment with their heads bowed.

Obama later tacitly acknowledged U.S. support for the regime under the administration of President Gerald R. Ford and said that the United States turned a corner after the election of Jimmy Carter in 1976.

“There’s been controversy about the policies of the United States early in those dark days, and the United States, when it reflects on what happened here, has to examine its own policies as well, in its own past,” he said. “Democracies have to have the courage to acknowledge when we don’t live up to the ideals that we stand for and we’ve been slow to speak out for human rights. And that was the case here.”

Praising Carter as “a president who understood that human rights is a fundamental element of foreign policy,” Obama said “that understanding is something that has influenced the way we’ve strived to conduct ourselves in the world ever since.”

Carter created a new State Department position to coordinate human rights efforts, and that appointee, Pat Derian, in turn sent diplomat F. Allen “Tex” Harris to Buenos Aires to provide a place of refuge for dissidents at the U.S. Embassy. The president cited Derian, Harris and U.S. journalist Bob Cox for taking personal risks to expose some of the junta’s worst abuses.

Obama, who ordered that the U.S. government now declassify military and intelligence records related to that period, said the global community needs to recognize that human rights violations continue to present a challenge around the world.

“Each of us has a responsibility each and every day to make sure that wherever we see injustice, wherever we see rule of law flouted, that we are honest witnesses,” he said, “that we’re speaking out and that we’re examining our own hearts and taking responsibility to make this a better place for our children and our grandchildren.”

Macri said the 40th anniversary was “a marvelous opportunity for all of the Argentine people together to say and claim, never again. Never again in Argentina to political violence, never again to institutional violence.”

He thanked Obama for his collaboration on human rights issues.

“This gives us an opportunity again to work together, the way you have been doing it, for the defense of these causes around the world,” Macri said.

But others did not feel as charitable toward the U.S. president. Throughout the city, people marched with drums and waved banners and carried images of people who vanished decades ago. Nobel Peace Prize winner Adolfo Perez Esquivel, a survivor of the period who published a letter decrying Obama’s visit, joined in the protests.

Carlos Pisoni was just 37 days old in August 1977 when both his parents, who were members of the Montoneros, an urban guerrilla group, were arrested and disappeared. He was handed over to his grandmother, who raised him.

“For us, it’s a provocation that the U.S. president is here, because the U.S. government took part in the coup here as well as in other parts of the region, as declassified documents show,” said Pisoni, who joined a demonstration Thursday in the Plaza de Mayo, where a group of mothers of the disappeared have been marching every Thursday afternoon for nearly four decades.

Pisoni said that many of the military officers who tortured and killed people during the Dirty War were trained at the U.S. Army School of the Americas, a ­Pentagon-run military institute formerly based in Panama. And even though Pisoni welcomed the new round of declassification, he said none of the survivors or victims’ families decided to participate in Thursday’s event with Obama because there were too many “open wounds.”

There were also protests in the town of Bariloche, where the first family spent the day hiking and boating.

Daniel James, a history professor at Indiana University, said that Obama is far less controversial here than George W. Bush, who faced protests when he visited in 2005 for the Summit of the Americas. But James added that many Argentines still view the United States through the prism of its interventions in Latin American affairs during much of the past century.

“The idea of the U.S. as an ideological hegemon is still part of their ideological makeup,” he said, adding that “50 to 55 percent of Argentines don’t have a positive view of the United States and its role in the world.”

Irene Caselli contributed to this report.