Image caption Competition to get in to school places in Hong Kong has become fierce

In early June, thousands of parents queued for hours outside a school in Sheung Shui district near the border between Hong Kong and mainland China.

The massed parents were waiting to find out whether their children had got into their primary school of choice.

Competition for school places has become fierce as more mainland Chinese children compete with local residents for places - and families on both sides of the border are finding it stressful.

One Hong Kong mother whose child did not get into her school of choice emerged with her hands covering her face to hide tears.

As local media surrounded her, she crouched down and sobbed uncontrollably.

These images have been playing out in the local press, amid rising grievances among Hong Kong residents over issues linked to the mainland.

The territory is governed under the principle of "one country, two systems", under which Hong Kong retains a high degree of autonomy for 50 years from the British handover. Its social services, amongst other things, are seen as more advanced than on the mainland.

Families along the border have fought in recent years over hospital beds and baby milk formula. Now the shortage of school places is making headlines.

'Getting worse'

As taxpayers we are paying for mainland Chinese kids to study here for the next nine years but my child can't go to school near home - it's not fair to us Zoe Pang, Hong Kong mother

The problem dates from a 2001 court ruling that gives babies born in Hong Kong to mainland mothers the same benefits as local residents.

From around 2006, it became a popular practice for mainland couples to come to the territory for the birth of their children. Since then more than 180,000 children have been born to mainland parents in Hong Kong.

Now many of those children are hitting school age, but the number of school places has not kept pace.

Last year, some 6,800 mainland students crossed the border from the Chinese city of Shenzhen each day to go to school in Hong Kong.

For the 2013-14 school year, the education ministry announced that there were 1,400 more applicants than school spaces available in the north district closest to the border.

"It's a 50% increase from the previous year and the competition is only going to get worse with the influx of mainland Chinese students," said the head of the North District Primary School Heads Association, Chan Siu-hung

To cope with the rising demand, the education bureau has increased class sizes and sent children to other school districts using a computerised system that does not discriminate between children living in Hong Kong or on the mainland.

This angers Hong Kong mother Zoe Pang, who has just found out that her son will now have to take a bus ride of almost an hour to school every day.

"As taxpayers we are paying for mainland Chinese kids to study here for the next nine years but my child can't go to school near home. It's not fair to us," said Ms Pang as she wiped away tears.

Image copyright AFP Image caption The issue of "birth tourism" has led to tensions between Hong Kong and the mainland

Another Hong Kong resident, Chang Liqun, came out feeling lucky that her son had got into her school of choice but she still feels the system needs to be improved.

"I'm not trying to be selfish but I believe that as families who live in Hong Kong we should be given priority. We're not trying to discriminate against mainland mothers but there aren't enough school spaces," she said.

'Equals'

But the mothers from the mainland say their children have rights too.

"Hong Kong's education and other social services are better than mainland China. I chose to give birth here so that my daughter can have a better life," said Shenzhen mother Cao Lulu, 35.

Hong Kong's schools are seen to be based on merit, while in the mainland bribery has crept into the system. Parents also seem to prefer Hong Kong's curriculum, where the English language education is seen as better.

Other families say that having a Hong Kong passport makes it easier for their child to study in Western countries.

Image caption Some Chinese parents see Hong Kong's curriculum as better

A mother from Shenzhen (she would only give her daughter's name and not hers before running off) was one big smile when she found out her daughter had got into her top school choice.

"I'm so happy, thank you," she said, bowing towards reporters. "All of our children are born in Hong Kong so they should be treated as equals."

Increasingly though, the Hong Kong government is under pressure to ensure that local residents have preferential access to the territory's limited resources.

It has already restricted mainland Chinese from buying too much baby milk formula and banned public hospitals from accepting pregnant mainland mothers.

Officials say both measures have been a success.

That gives little comfort to Hong Kong resident Ho Mei Yin. Her six-year-old daughter did not get a place in a school near her home.

The little girl's name is now on a waiting list in case anyone forfeits their place. Ms Ho will find out this month if she is successful.

But even if she jumps this hurdle, Ms Ho believes her child will have to continue competing for resources with other children along the border as she gets older.