BANGKOK (AP) — The prejudice and hostility that Rohingya Muslims face in Myanmar stretch beyond the country's notoriously brutal security forces to a general population receptive to an often-virulent form of Buddhist nationalism that has seen a resurgence since the end of military rule.

Many of Myanmar's Buddhists have objected to the way the media and international community have portrayed the crisis in Rakhine state, which has caused a half million Rohingya to flee the country in the past month. Rather than recognize what the U.N. calls ethnic cleansing, they see a threat to national sovereignty and the future of Myanmar as a Buddhist-majority nation.

The standard academic work cited by Buddhist nationalists seeking to argue their case against the Rohingya — who they see as migrants living illegally in Myanmar — has a telling title: "Influx Viruses: The Illegal Muslims in Arakan."

"They are seen as foreigners trying to infiltrate the country, and Buddhists of the strident type see them as trying to undermine their faith," said Robert Taylor, a scholar of Myanmar's political history.

Yet just as Rohingya have roots in Myanmar stretching back centuries, so do the historical forces that have shaped their oppression.

British Colonialism

The Rohingya, while not recognized as an ethnic group in Myanmar, are decedents of centuries of intermingling between indigenous Muslims and migrants from the area that is now Bangladesh and India's West Bengal. They lived mostly untroubled until after the British arrived and Myanmar became part of British colonial India and later the separate colony of Burma.

For about a century until the 1930s, more than a million South Asians — Muslims and Hindus alike — flooded into the country to take jobs as laborers, civil servants and moneylenders, leading to a "deep resentment" among the Burmese, said Mikael Gravers, a Danish anthropologist specializing in Myanmar.

They "took work from Burmese and land from peasants who could not pay their debt," he said.

The identity of Indians was intertwined with the British colonizers, and that was seized upon in the 1920s by the nascent Burmese nationalist movement in which Buddhist monks were closely involved.

"Burmese nationalists saw themselves as colonized twice, first by the British, secondly by the Indians who, in particular, dominated the economy," Taylor wrote in a 2015 study of ethnicity in Myanmar.

The Rohingya, with their dark skin and South Asian features, were caught up in this resentment. By the time the British were pushed out by the Japanese in 1942 — an invasion welcomed by the nationalists — Buddhist locals in Arakan, which is now Rakhine, took out their frustrations on those seen as British allies: Muslims, including the Rohingya. Thousands were killed in attacks and Muslim counterattacks.

Religion

Myanmar is almost 90 percent Buddhist, and for nationalists, religion has always been a successful issue with which to whip up support. That has been helped, both past and present, by the involvement of Buddhist monks in the movement.

With monks involved, "the alleged threat posed to the persistence of Buddhism as the religion of the majority of the population began to seem real," Taylor wrote. "The memory of 'Indian domination' and 'Buddhism in danger' became part of the legacy of the nationalist movement inherited by Myanmar politicians and historians."

Gen. Ne Win, who led a 1962 coup that led to five decades of military rule, wasn't known as a particularly devout Buddhist, yet he was influenced by the Buddhist nationalism of the colonial era.

His nationalization of private enterprise put much of the large ethnic Indian trading class out of business. He was also responsible for letting loose the security forces on the Rohingya in 1977 and 1978, launching a hunt for illegal immigrants that set off the first major exodus to Bangladesh of some 200,000 people.

His most toxic legacy for the Rohingya was a 1982 citizenship law that basically granted full citizenship rights only to members of ethnic groups settled in Myanmar before 1823. Some 135 ethnic groups were officially listed as meeting this historical deadline, but not the Rohingya. This official decertification of Rohingya rights still serves as justification within Myanmar for their statelessness and social ostracism.

Myanmar also has a Muslim population distinct from the Rohingya who live in a mostly assimilated manner in other parts of the country outside Rakhine. Yet Muslims of every kind become targets of scapegoating in times of tension, a trend that has grown in recent years.

Rohingya, who numbered about 1 million among Myanmar's 53 million people before the recent exodus, evoke an oversized fear and loathing among nationalists, who trot out statistics purporting to show that they have far higher birth rates than others in Myanmar.

Democracy and demagoguery

Myanmar began the shift away from military rule in 2011 with the seating of an elected, though military-backed, government. An election in 2015 brought democracy leader Aung San Suu Kyi to power, though with military restraints on her authority.

"Since the start of the political transition in 2011, Buddhist nationalism in Myanmar has become significantly more visible," Brussels-based International Crisis Group said in a report this month. "As authoritarian controls were lifted after years of repression, deep-seated grievances emerged into the open, and new freedoms of expression allowed individuals and the media to give voice to these grievances in ways that were not possible before."

Access to new forms of communication, such as cellphones and social media, has helped accelerate the spread of nationalist narratives, hate speech and rumors, it said. Often such rumors are tales of sexual violence allegedly perpetrated by Muslims against Buddhist women.

Rakhine state has Myanmar's largest concentrations of Muslims by far, and historically has been regarded as a buffer against Muslim neighbors to the west. Yet it wasn't until violence broke out in 2012 that it became a focal point for Buddhist nationalists.

"If you asked about the Rohingya 20 years ago, most Burmese in Rangoon would be indifferent," Michael Charney, a Southeast Asia specialist at London's School of Oriental and African Studies, said, using another name for Yangon, the country's largest city. "This situation has changed in the last few years — in part, ironically, because of the greater freedoms made possible since 2010."

Events outside Myanmar also lent credibility to dire warnings of a Muslim takeover: the rise of militant Islamist groups, and the consequent tide of Islamophobia in the West.

"It is important to take the fear of Muslim conquest seriously. It is a result of 50 years of isolation, limited education, violence, injustice and insecurity during military rule," said Gravers, the anthropologist. "This paranoia has returned during the transition from military rule. But now global influence in the form of al-Qaida and Islamic State has an important role too."