SAO PAULO, Brazil — In some of his first words to the nation as president-elect, far-right politician Jair Bolsonaro has promised to defend the constitution and unite a bitterly divided populace. His left-leaning rival immediately vowed to mount a vigorous opposition, while rights groups warned against a rollback of civil liberties. That juxtaposition underscored that the end of the election was not the end of acrimony and that myriad challenges lay ahead for Latin America’s largest nation. Bolsonaro appeared to try to allay those concerns Sunday night, saying he would "pacify" Brazil following a race that revealed deep divisions and was repeatedly marred by violence. The candidate himself was stabbed and almost died while campaigning in early September, and there were numerous reports of politically motivated violence, especially directed at gay people. "This country belongs to all of us, Brazilians by birth or by heart, a Brazil of diverse opinions, colors and orientations," he said, reading off a sheet of paper in a live television address. But in a sign of the challenges ahead, the #EleNaoEMeuPresidente — #HeIsNotMyPresident in Portuguese — was the top trending topic on Twitter in Brazil on Monday morning. Bolsonaro’s victory moved Brazil, the world’s fourth-largest democracy, sharply to the right after four consecutive elections in which candidates from the left-leaning Workers’ Party won. Bolsonaro built his popularity on a mixture of often outrageous or offensive comments and hardline positions. He has frequently disparaged women, gays and blacks, praised torture and killings by police, and has said he would name military men to his Cabinet. He often took to Twitter to lambaste the rival Workers’ Party as unethical and dangerous. In recent weeks, Brazilians were bombarded with WhatsApp messages that condemned Workers’ Party candidate Fernando Haddad, often making outrageous claims. Ultimately, Bolsonaro’s messages resonated with Brazilians hungry for change: He got just over 55 percent of the votes Sunday, compared to just under 45 percent for Haddad.