RIO DE JANEIRO -- In Mozambique, Brazil's government is opening a plant making antiretroviral drugs to fight the AIDS epidemic. Brazil is lending $150 million to Kenya to build roads and ease congestion in the capital, Nairobi. And in Angola, a rising oil power, a new security agreement seeks to expand the training of Angolan military personnel in Brazil.

Brazil, which has more people of African descent than any other country outside of Africa itself, is assertively raising its profile again on the continent, building on historical ties from the time of the Portuguese empire.

The array of aid projects and loans recently extended to African countries points both to Brazil's ambitions of projecting greater influence in the developing world and to the expanding business allure of Africa, where some economies are rapidly growing even as parts of the continent still grapple with wars and famine. The charm offensive is paying off in surging trade flows between Brazil and Africa, growing to $27.6 billion in 2011 from $4.3 billion in 2002.

''There's the growing sense that Africa is Brazil's frontier,'' said Jerry D?la, a historian at the University of Illinois who has written extensively about Brazil's inroads across the South Atlantic Ocean. ''Brazil is in the privileged position of finally reaching the institutional capacity to do this.''

Brazil's forays into Africa are similar to the ambitions of other rising powers, like Turkey, which has established its sway in the Arab world, and India's promotion of its culture across Asia.

The prominence given to Africa also reflects Brazil's shift from aid recipient to provider. Big development challenges persist in Brazil, including woeful public schools and a sharp economic slowdown this year. But Brazil is a major agricultural exporter that recently surpassed Britain as the world's sixth-largest economy, and it now boasts more embassies in Africa than Britain does -- a notable change from when Brazil relied on foreign aid in the 1960s, largely from the United States, to alleviate hunger in the country's impoverished northeast.

Africa now accounts for about 55 percent of the disbursements by the Brazilian Cooperation Agency, which oversees aid projects abroad, according to Marco Farani, the agency's director. Altogether, including educational exchanges and an expanding loan portfolio, Brazil's foreign aid exceeds $1 billion, he said. Big portions of Brazilian aid also go to countries in Latin America, and there is a smaller focus on East Timor, the former Portuguese colony in Southeast Asia.

''We still have a smaller foreign aid profile than other some countries, but we're learning how to do cooperation,'' Mr. Farani said.

Brazil still trails other nations, notably China and the United States, which have far more expansive aid programs and trade in Africa. Elsewhere in Latin America, Venezuela and Cuba have offered different ways of enhancing African ties. Venezuela organized a 2009 summit meeting of African and South American leaders, in which President Hugo Ch?z tightened an alliance with Libya's leader at the time, Col. Muammar el-Qaddafi.

During the cold war, Cuban troops supported Communist governments in Africa. In Angola, this mission included the seemingly paradoxical task of protecting a Chevron oil complex at the same time the United States was supporting an insurgency against Angola's leaders. More recently, Cuba has sent thousands of doctors to Africa.

But while the Cuban and Venezuelan efforts have largely prioritized developing-world solidarity with some African nations, Brazil's growing foothold in Africa is more complex, involving ambitions to forge Brazil into a diplomatic and economic powerhouse.

After a surge of openings of diplomatic missions over the past decade, Brazil now has 36 embassies across Africa, and hopes to open its 37th in Malawi this year. Brazil is already using this presence to bolster its actions on the world stage, sending jets to fly delegations from Sierra Leone, Liberia and Cape Verde to the United Nations Conference on Sustainable Development, which was held here in June.

Other projects are intended to lure Africans to study in Brazil. A new university began offering classes last year for students from Portuguese-speaking countries, including Angola, Guinea-Bissau, Mozambique, and S?Tom?nd Principe.

Since Brazil does not need to import large amounts of oil or food, its plans in Africa differ somewhat from other countries seeking greater influence there. Outreach projects tie largely into efforts to increase opportunities for Brazilian companies, which sometimes work with Brazil's government in offering aid.

Some of Brazil's biggest inroads, predictably, are in Portuguese-speaking countries like Angola, where the Brazilian construction company Odebrecht ranks among the largest employers, and Mozambique, where the mining giant Vale has begun a $6 billion coal expansion project.

But Brazilian companies are also scouring other parts of Africa for opportunities, putting down stakes in Guinea and Nigeria. A leading Brazilian investment bank, BTG Pactual, started a $1 billion fund in May focused on investing in Africa. New links are also emerging, including Brazilian farming ventures in Sudan; a flight from Addis Ababa, Ethiopia's capital, to S?Paulo; and a fiber optic cable connecting northeast Brazil to West Africa.

Some of Brazil's forays in Africa have come with complications, including criticism of warming ties with leaders connected to human rights abuses, like Equatorial Guinea's president, Teodoro Obiang Nguema Mbasogo. A freedom-of-information measure has enabled journalists to delve into African arms deals by Brazilian companies, including the sale of cluster bombs to Zimbabwe.

African students studying in Brazil have filed numerous complaints describing slurs and aggression, complicating the myth of ''racial democracy'' that once prevailed here, in which scholars contended that Brazil had largely escaped the discrimination common in other societies.

In one episode here in Rio, Eleut?o Nhantumbo, a Mozambican police officer with a scholarship to study public security at a Brazilian university, said he was stopped by police officers on one occasion. They ordered him to raise his shirt upon exiting a store on the suspicion that he had stolen something.

When he questioned why they had singled him out, he said the officers responded with a racial slur and warned him of addressing them without respect; hearing his accent in Portuguese, they queried him about his origins. ''The police asked, 'Where's Mozambique?' '' said Mr. Nhantumbo, 33. ''They didn't know that there existed a country with this name.''

Brazil, closely linked for centuries to Africa through shipping routes and the slave trade, is thought to have imported 10 times as many slaves as the United States did before slavery was abolished here in 1888. For a stretch in the 19th century, Brazil was the seat of the Portuguese empire, making the capital then, Rio de Janeiro, a nerve center for trade with Africa.

Those ties withered until civilian leaders sought to establish relations with newly independent governments in Africa in the early 1960s. That process cooled after Brazil's military rulers seized power in a 1964 coup supported by the United States.

Then economic necessity and a quest to build autonomy from the United States laid the foundations in the 1970s for today's diplomatic buildup in Africa. Seeking to offset spending on oil imports, including cargoes from Nigeria, military rulers set about opening new markets in Africa for Brazilian companies. They found some success, notably in newly independent Angola.

Brazil's former president, Luiz In?o Lula da Silva, built on those inroads in trips to Africa from 2003 to 2010, referring to the ''historic debt'' Brazil had to Africa in its formation as nation.

PHOTO: In Luanda, Angola, construction workers for the Brazilian company Odebrecht, which is among Angola's largest employers. (PHOTOGRAPH BY ISSOUF SANOGO/AGENCE FRANCE-PRESSE -- GETTY IMAGES) (A7)