LATAKIA, Syria, April 13 (Reuters) - For three years, residents of Syria's Mediterranean provinces have watched from their coastal sanctuary as civil war raging further inland tore the country apart, killing tens of thousands of people and devastating historic cities.

But a three-week-old offensive by rebel fighters in the north of Latakia province, a bastion of President Bashar al-Assad's Alawite minority, has brought the battle ever closer and shattered that sense of relative security.

Rebels are now fighting in the hills overlooking the sea, bringing the country's main port of Latakia within their range - rocket-fire killed eight people in one barrage on the city a month ago - and Syria's coast feels under real threat.

"They can erase us, even those of us who support them," said a young Alawite woman as she drank coffee with her fiance in a Latakia cafe, 50 km (30 miles) south of where have rebels seized their first toehold on Syria's coast, by the Turkish border.

While many Alawites, roughly 10 percent of Syria's 23 million people, have actively supported Assad, others sympathised with the popular revolt against him in 2011 but now fear reprisals from his mainly Sunni Muslim enemies.

Memories of a rebel offensive in August, when scores of Alawite villagers near Latakia were killed by radical Sunni Islamists and foreign jihadists, heighten tensions in the bustling streets of the city of 400,000.

Even as Assad, 300 km to the south in Damascus, sounds ever more confident of holding on, the chaotic ebb and flow of civil war has intruded even into this most sheltered part of the state, while the hunt for spies and traitors and losses suffered by Assad loyalists continue to sour daily life.

Even before the bombardments started to encroach on the once peaceful city, the cost of Syria's war was plain from the daily funeral processions for fallen soldiers and pro-Assad militia.

"Everyone here has been sending their sons to fight the war in other parts of Syria, and every day we hear the sirens and funerals of those soldiers," said Yasmin, a woman in Latakia who has been active in opposing Assad.

But the arrival of the war on its doorstep has, she said, unnerved the city: "We thought that we were somewhat invincible, as if the rebels would never reach us. But that's not true".

Yasmin said school buildings have filled up with Alawite refugees who fled villages further north to take shelter in the city - a common sight elsewhere but a new phenomenon on the coast: "Now they're like so many other displaced Syrians."

WITHIN RANGE

The fighting which has brought fear to Latakia started three weeks ago when rebels moved in from Turkey and seized the border crossing at the Armenian Christian village of Kasab - the last crossing point from Turkey into government-controlled territory.

They also captured a small beach nearby to give them their first beachhead on Syria's 250 km of Mediterranean coastline - a symbolic though militarily insignificant gain. They battled Assad's forces for control of hilltops that include a satellite communications post known as Observation Point 45.

Nervous Latakia city residents say heavy artillery fire could easily strike them from that vantage point.

"It's not going to matter if you're with them or not," said a young dentist, speaking in the city centre. "The mortars won't make a distinction. And if the rebels come down here, they won't take time to distinguish between who's with them and who's not."

As elsewhere in the tortuous, grinding war that has already killed 150,000 people, there is no indication that the fighting in Latakia marks any decisive shift in the broader conflict.

The streets of Latakia are as busy as ever, even if only one ship was visible in the harbour in the first week of April - in ordinary times it handles dozens. On Thursday afternoons, bus tickets out of Latakia sell out fast as college students who board at the local university return home for the weekend.

But authorities in the port, which is also a hub for the U.N.-backed international operation to ship out Syria's chemical weapons arsenal by the end of the month, appear anxious.

Two months ago, they shut down Internet connections from cafes and other public places along the entire coast, apparently to prevent communications that evade surveillance.

One cafe owner in Tartous, a city 40 km north of the Lebanese border which also hosts a Russian naval base, said he had protested in to the authorities about being forced offline.

"They told me when people go online from a public place, they can't trace that person like they trace people who surf the net from home," he said.

At frequent government checkpoints along the main coastal highway, armed men scrutinise ID cards for clues to travellers' religion and political sympathies. Most security personnel and senior military officers on the coast hail from local Alawite villages, and have a keen eye for spotting outsiders.

"What are looking scared about?" barked one armed state security patrolman at a nervous college student on a public bus travelling between Latakia and Tartous.

He took the young man's document to "float it" - check it in a computerised system for outstanding warrants or summonses from any of Syria's numerous intelligence agencies.

The process takes a few moments, but can feel like an eternity - since the uprising, many people have been detained after their papers were "floated", or have simply disappeared.

Local people say they have begun to see Iraqi Shi'ite militiamen along the coast, apparently boosting the ranks of the Syrian military. Iraqis, who speak a distinctive dialect, have joined those from Lebanon's Hezbollah as well as advisers and commanders from Shi'ite regional power Iran in aiding Assad.

This correspondent saw unarmed men wearing military fatigues with Shi'ite insignia strolling around several Syrian coastal towns and speaking with Lebanese accents. Alawites consider themselves an offshoot of the Shi'ite branch of Islam.

COMMUNAL VIOLENCE

The death last month of Hilal al-Assad, a cousin of the president, has added to the new feeling of vulnerability among government loyalists in the coastal provinces.

The man, who led the local branch of the National Defence Force militia, died three weeks ago in a battle near the Turkish border with Islamist rebels - the first member of the extended ruling family to be killed since a bombing in Damascus in 2012.

Rumours of rebel atrocities against Christians in the ethnic Armenian town of Kasab, circulated among the Armenian diaspora abroad, have added to the febrile atmosphere further down the coast - despite efforts by rebels to disprove the allegations.

Communal violence has become a feature of the war.

When two people from the ethnic Turkmen community were found dead in a park in Latakia last month, their killing was widely seen as a revenge attack by Alawites for perceived Turkmen support for the rebels and their ties with Assad's enemy Turkey.

Sunni neighbourhoods on the coast are being increasingly targeted by security forces hunting rebels, residents say. Young men are detained and taken away for interrogation in facilities where rights groups say many have been tortured and killed.

On the coast road near Tartous last week, a white minibus drove by escorted by three government vehicles mounted with machineguns. Inside the van, were about a dozen, mostly young, men. Their arms appeared to be shackled behind their backs.

Several had their eyes covered by blindfolds. (Editing by Dominic Evans and Alastair Macdonald)