Thousands of people flocked to a zoo in Japan on Sunday to say farewell to the country's last two giant pandas, who are set to return to China on Tuesday.

Emotions ran high at the Ueno zoo in Tokyo as people stood in line – some for as long as three-and-a-half hours – to see twin cubs Xiao Xiao and Lei Lei one last time.

This comes at a very tense moment in relations between Tokyo and Beijing. Ties have sharply deteriorated after Japanese Prime Minister Sanae Takaichi stated that Tokyo would get involved militarily if China attacked Taiwan.

The twins' departure will leave Japan without any pandas for the first time since 1972, the year the two countries normalized diplomatic ties.

The People's Republic of China has used giant pandas as a gesture of goodwill towards its international allies and competitors since it was founded in 1949.

However, China retains ownership of all pandas loaned to foreign countries, including cubs born abroad. Host countries pay an annual fee of about $1 million (£790,000) per pair of pandas.

According to Tokyo's metropolitan government, about 108,000 people competed for one of the 4,400 slots available for one last look at the zoo's beloved pandas.

I have been bringing my son here since he was a baby, so I hope it becomes a good memory for him. I'm glad we could come today to remember them, Ai Shirakawa told the BBC.

Another visitor recounted the joy of watching the pandas grow, saying, Witnessing their growth, especially since they were so small, has been such a joy. Many were seen crying during the farewell.

Xiao Xiao and Lei Lei were born in 2021 at the Ueno zoo and are children of Shin Shin and Ri Ri, pandas on loan for breeding research.

In recent years, China's panda loans have often linked with significant trade agreements. For instance, the 2011 loan to Edinburgh Zoo coincided with significant trade deals regarding salmon meat, energy technology, and vehicles.

Many pandas have been returned to China recently due to the 10-year loan agreement, but prospects for a new loan to Japan remain uncertain amidst the increasing tensions.

The Japanese prime minister's remarks on Taiwan have sparked outrage in Beijing, which sees the self-governed island as part of its territory, exacerbating the already strained relations between the two nations.

Consequently, both countries have engaged in a series of aggressive actions against each other, including Chinese restrictions on rare earth exports to Japan.