By LARA JAKES

AP National Security Writer

LUANDA, Angola (AP) _ Traveling from lush green hilltops to hot dusty roads and seaside ports, U.S. Secretary of State John Kerry asked African nations last week to make a choice: Choose democracy. Embrace economic stability. Reject violence, and move people into the modern world.

It was an optimistic offer, and the kind of Western attitudes the U.S. is used to espousing. But two conflict-wracked African nations said no, challenging the limits of American influence in a continent that is emerging as the next land of opportunity for foreign financial investors.

So far, the U.S. is lagging in the worldwide race to reap economic benefits in Africa, and President Barack Obama is hosting a summit this August for leaders of more than 40 African nations to try to build stronger financial ties. The refusal this week by several leaders to heed Kerry’s urgings now confronts the Obama administration with a choice of its own: Pursue economic opportunities with governments that do not respect rule of law or human rights, or take a backseat in global competition by shunning obstinate sub-Saharan countries.

“This is up to the will of the people, and the will of leaders,” Kerry told about 100 diplomats and local activists gathered at an environmentally friendly tukul hut atop a hilltop in Addis Ababa, the Ethiopian capital. “We need to make certain that we grab the choice that seizes the future, and we need to refuse to be dragged back into the past.”

He added, “I have absolutely no doubt that this could be an inflection point for the new Africa, a time and a place where Africans bend the arc of history toward reform, and not retribution; toward peace and prosperity, not revenge and resentment.”

In what appears to be the biggest flop of his trip, Kerry announced a tentative agreement to restart stalled peace talks in South Sudan, where U.S. officials say six months of fighting between President Salva Kiir and former Vice President-turned-rebel leader Riek Machar have plunged the world’s newest nation into a civil war.

But even before Kerry left Africa on Monday, Machar called the peace talks premature. And he derided the American diplomat’s demand for a transitional government. Kerry continued to hold out hopes that the talks would happen as soon as this week, saying Machar “didn’t close the door” on negotiations. Kiir, meanwhile, sent troops into two rebel strongholds in a violent offensive that the State Department quickly denounced as a violation of an earlier cease-fire agreement.

Kerry again raised the possibilities of imposing financial and travel sanctions against both leaders and their most violent commanders, as well as sending in U.N. troops to quell the fighting. But such threats have been bandied for weeks without any apparent impact. Leaders in neighboring countries are reluctant to take similar steps that would hurt their own economies or otherwise draw political opposition.

Kerry’s visit last Friday to Juba, the South Sudan capital, “is coming at a crucial time and cannot serve as an empty gesture or a photo op,” Raymond C. Offenheiser, president of human rights group Oxfam America, said in a statement. “This visit and subsequent follow through by the administration must demonstrate to all that the U.S. will not tolerate a prolonged conflict that neither side can win and in which civilians are the clear losers.”

On another losing front, Kerry promised $30 million in election assistance aid for the upcoming 2016 presidential vote in Congo, which has weathered at least 20 years of fighting between the government and a number of rebel groups. But as he pledged the money, Kerry urged President Joseph Kabila to step down at the end of his current term in office, as required under Congo’s constitution.

The response by Kabila’s government was almost comically unenthusiastic. Congo government spokesman Lambert Mende said the constitution would be respected, but also suggested it could be revised.

“Why all this noise just about Congo, when there are more than 15 countries that are going to organize elections in the next year?” Mende said.

Other leaders held Kerry’s requests at arms’ length throughout the trip, from ensuring press freedoms from Ethiopia’s oppressive government to demanding that Ugandan security forces leave South Sudan or otherwise work under the auspices of the United Nations.

At the same time, the U.S. does not want to miss out on economic gains available in Africa, which has vast oil and gas resources and a middle class that is expected to double over the next decade. And it was impossible to ignore the number of construction cranes erecting new buildings around Addis Ababa, or the Chinese hotel next to Juba’s airfield, or the presence of General Electric at Luanda’s shipping port.

Compared to competitors across the world, the U.S. companies “have been slower to sort of pick up on the growth in Africa,” said Elizabeth Littlefield, president and CEO of the U.S. Overseas Private Investment Corp.

But in the last several years, she said, American companies like IBM and GE have opened major offices across Africa. Legal and accounting firms also have flocked to the continent to help the expected flood of U.S. investors navigate various nations’ business rules. And the U.S. Commerce Department is planning to open a commercial service office in Luanda.

OPIC financed $1 billion in loans for U.S. investors last year, and since 2008 has increased by five-fold the number of businesses it works with.

Much of the test of Africa’s future will come in elections in 37 nations over the next three years, and of course, whether warring and threat of famine continue to mire the continent.

Kerry said the U.S. is looking for more than simply an economic relationship with Africa, drawing an unspoken comparison to nations like China, which is sinking 5 percent of its foreign direct investment into the continent, compared with 1 percent by the U.S. But despite building roads and hotels in Africa, officials say China has done little to create long-term jobs or provide services like health care and education training for local workers.

“Africa has the resources; Africa has the capacity; Africa has the know-how,” Kerry said in his speech in Addis Ababa. “The questions that Africa faces are similar to those confronting countries all over the world: Do we have the political will, the sense of common purpose to address our challenges? Are we prepared to make the hard choices that those challenges require?”

“The continent’s course is ultimately up to you,” Kerry said.