Pope John Paul II took a trip to see the fabled Amazon today and then ended his triumphal 12-day journey through Brazil, a trip that clearly reinforced the vigor, determination and importance of the Roman Church in the world's largest Catholic country.

John Paul insisted more than a year ago, when he was first invited to Brazil, that he wanted to see the mighty Amazon, the world's most powerful and second longest river. His wish became a colorful spectacle today as a Navy frigate carrying the Pope on the Rio Negro was erected by hundreds of river steamers and small pleasure craft. The flotilla, which came within sight of the head of the Amazon, was an indication of the interest and affection Brazilians hold for the first pope ever to visit their vast nation.

John Paul was seen by millions of people here and touched millions more with his determined, if hesitant, efforts to speak in Portuguese and his many simple acts of kindness. At one point, he left a gold ring with the poor residents of a slum in Rio de Janeiro he visited last week. But the pope also was obviously deeply affected by his stay.

"I take in my eyes and in my heart so many images of life and beauty that impressed me in this pulsating and promising country," the pope said as he boarded his plane to Rome late this afternoon. "The last of them will be the amazing picture of these rivers and forests of the Amazon."

But, he added "even more than the images of so many wonders, both natural and manmade, it is the image of the Brazilian man that I take with me. I will always ask God that the great Christian principles, so long enrooted in you, and above all your sense of God and human solidarity, may continue to mark the faithfulness of Brazil to itself and to its historic identity."

During his trip the pope visited this country's futuristic capital, Brasilia; its great cities, Rio de Janeiro and San Paulo; the impoverished urban centers of the northeast, Recife, Salvador and Belem, and finally the Amazon capital of Manaus. Throughout the journey, John Paul spoke out eloquently and strongly for changes in Brazil to provide greater social justice for the poor and oppressed.

Yesterday, for example, the pope expressed his concern for Brazil's hundreds of Indian tribes, many of them still living in the Amazon jungles, who are being deprived of their lands, their rights and sometimes their lives as Brazil seeks to clear and cultivate large jungle tracts by encouraging agro-businesses and large landowners to develop the region.

"I entrust to the public authorities and others in positions of responsibility the wishes that I make, with all of my heart [and] in the name of the Lord, that you, the first inhabitants of this land, be recognized [as well as ] the right to live on [the land] in peace and tranquility," John Paul told a group of Indian leaders selected to meet and describe their problems to him here.

"May you not have the fear and true nightmare of being removed for the benefit of others," the pope said, once again entering directly into one of the many controversies that separate Brazil's liberal church from the country's conservative military government.

"May you remain secure in a living space that is the base not only for your survival but for the preservation of your identity as a human group."

It is estimated that only about 100,000 pureblood Indians live in Brazil compared to as many as 6 million that may have inhabited the country when it was first discovered by European explorers in the 16th century. The Indians are threatened by the government's efforts to develop one of the world's last great wildernesses, a policy the Brazilian church has opposed and which is a prime example of its social ministry on behalf of the poor.

Although the pope cautioned Brazil's Catholic clergy repeatedly against getting directly involved in partisan politics and from adopting "alien" ideologies, specifically Marxism, he supported the Brazilian church's efforts to improve the social and economic conditions of the country's tens of millions of poor who have not benefitted from Brazil's rapid economic growth.

On the doctrinal issues, John Paul remained resolutely conservative. But he did not emphasize these issues, concentrating instead on the church's role in defending and fighting for the human, social and economic rights that are the burning problems here and in much of the rest of Latin America.

Brazil's military government has, during the past year, begun dismantling some of its most repressive laws and policies. The press and opposition political parties are freer than before to criticize and bring their views before the people.

But none has had so wide an audience as did John Paul during his 12 days here. The pope also had free access to the country's radio and television, a privilege not normally granted to those urging such drastic changes in the country's economic and social policies.

The pope seemed to be referring to this opportunity, which he seized to the delight of liberal bishops when he said today on his departure that he wanted to "entrust one wish" to Brazil before he left:

"That your doors, which were opened to me with such love and confidence, may remain wide open to Christ. This will be my greatest joy."