With its Carnival reputation and skin-baring beach life, Brazil may look like a liberal bastion. But unease over a worsening economy and deteriorating public safety, plus a backlash against recent gay-rights gains, are propelling a conservative rise that will shape the next administration, regardless of who wins the presidency.

The general election held earlier this month saw a greater share of Brazil's National Congress seats go to various conservative caucuses, which now control nearly 60 percent of the 513 seats in the lower house. They include evangelical lawmakers who oppose gay marriage or access to abortion; "ruralistas" whose pro-agriculture positions counter environmentalists and indigenous groups; and a law-and-order faction that demands a crackdown on crime.

Ahead of the presidential runoff Oct. 26, there's no doubt such conservatives are giving greater support to center-right challenger Aecio Neves over left-leaning President Dilma Rousseff. But it's also clear that neither presidential candidate is as socially conservative as the increasingly powerful elements of Congress.

"Brazil is one of the very few Latin American countries where the parliament is more important than the president in terms of overall power in the decision-making process," said Thiago de Aragao, a political analyst for the Brasilia-based Arko Advice consulting firm. "The parliament, in an arm-wrestling contest against the presidency, would win ... because the parliament's main weapon is just crossing their arms and not voting on matters that are of strong interest to the government."

Despite its anything-goes appearance, Brazil is, like many predominantly Roman Catholic nations in Latin America, socially conservative. In recent opinion polls, for example, more than 80 percent of Brazilians said they oppose loosening their restrictive abortion laws or legalizing marijuana and just over half oppose gay marriage.

However, since Brazil's return to democracy in 1985, the nation's presidents and its judiciary have pushed through progressive projects either by decree or rulings — such as protecting huge swaths of jungle as indigenous reserves, a high-court ruling permitting same-sex civil unions, and the creation of Bolsa Familia, a program that gives monthly cash payments to Brazil's poorest families.

Some predict such changes could be rolled back by the growing conservative forces.

The evangelical caucus votes in lockstep on hot-button social issues and is willing to block projects put forth by the presidency because its members know they represent a growing segment of the electorate. While Catholics remain the majority in Brazil, since 1970 their portion of the population has fallen from more than 90 percent to 65 percent while those identifying as Protestants have grown from 5 percent to 22 percent, according to the Pew Research Center.

In Rousseff's first term, the evangelical caucus blocked her effort to promote gay-tolerance teaching in schools and managed to have their most outspoken anti-gay legislator, Deputy Marco Feliciano, named head of the body's human rights commission — a move that provoked condemnation from Amnesty International and other activist groups. In the Oct. 5 election, Feliciano was re-elected to his Sao Paulo district with nearly double the votes he won four years ago.

The "ruralista" caucus also grew and now has about 200 members who support its agenda. These lawmakers showed their strength in 2012, forcing weakening of environmental protection laws, which critics say contributed to a 29 percent jump in the number of Amazon acres deforested over the last year.

And while the law-and-order block is small with only about 20 members, it wields influence on security issues. The caucus' members defend tougher penal codes for young offenders and want to block the sort of drug liberalization seen in neighboring countries, even as Brazil copes with overcrowded prisons and years of failed efforts to suppress powerful drug gangs.

But it's the evangelical lawmakers who are at the heart of Brazil's growing conservatism, and they've shown an ability to rally the other groups behind their main cause: defeating any attempt to legalize gay marriage or advance protections for LGBT communities.

Toni Reis, who heads the gay rights advocacy group Dignidade, noted it took a landmark Supreme Court decision to legalize same-sex civil unions in 2011 following years of congressional stalling on the matter. Now, he said, gay rights groups are focused not on gay marriage but on advancing legislation to criminalize discrimination against gays.

Given the new legislative reality, Reis acknowledged it will be an uphill battle.

"We're going to have to work twice as hard," he said.

Jean Wyllys, Brazil's first openly gay congressman, said progressive lawmakers won't give up.

"There's no doubt it's going to be more difficult," said Wyllys, who represents Rio de Janeiro state. "But I also have my allies. ... We are a political force capable of blocking their (the evangelicals') legislative projects."

But Brazil's most influential evangelical pastor, Silas Malafaia, who campaigned for several Pentecostal politicians, says the conservatives don't intend to impose stances out of step with the electorate.

"I am against gay marriage. Let's hold a referendum and let society decide," Malafaia said in a recent interview. "If the people decide that they want abortions (to be legalized), I will always be against it, but I will respect those decisions. We're not evangelical extremists trying to impose what we think with an iron fist."

___

Associated Press writer Brad Brooks contributed to this report.

___

Jenny Barchfield on Twitter: www.twitter.com/jennybarchfield