Behind them lay the makeshift campgrounds where they had spent months living rough, waiting for the right moment to climb the six-metre, razorwire fence lying between them and their dream of making it to Europe. In front of them lay an immaculately groomed golf course complete with white-clad golfers teeing off.

The two radically different realities, just metres apart, was what greeted a dozen or so migrants caught on the triple fence that marks the border between Spain’s north African enclave of Melilla and Morocco on Wednesday. After 200 had tried to scale the fence, Spain’s interior ministry said 20 people had made it to the enclave and another 70 remained perched on top of the fence for several hours.

The photo was taken by José Palazón, of the migrant rights group Pro.De.In Melilla, after he noticed that some of the migrants had got caught on the fence in the area overlooking the golf course.

“It seemed like a good moment to take a photo that was a bit more symbolic. The photo reflects the situation really well – the differences that exist here and all the ugliness that is happening here,” he told El País newspaper.

Each year thousands of Africans – many of whom have spent years travelling across north and sub-Saharan Africa – try to reach Europe by making it past the fortified fence that separates Morocco from the Spanish enclaves of Melilla and Ceuta. Many of them spend months living in makeshift camps on the Moroccan side, waiting for the opportunity to rush the fence.

On Wednesday Palazón posted his photo on Twitter, writing: “Immigrants on the fence, expulsions and a game of golf. Only in Melilla.”

As Guardia Civil officers urged the migrants to climb down and the migrants worried that they would be returned to Morocco if they did so, the photo was shared thousands of times on social media.

Several organisations have express concerns in recent days about the actions of Spanish officers at the fence, after Pro.De.In released a video that showed several of them beating a migrant with their batons as he climbed down from the fence. As he fell to the ground, he appeared to be unconscious as officers carried him back to the Moroccan side of the border.

“This worries us,” the Spanish spokesperson for the UN High Commissioner for Refugees, Maria Jesus Vega, said of the video footage. “These images show that some parties are not acting as they should. There are people beating those who are on the fence.”

Judith Sunderland, of Human Rights Watch, called on Spain to investigate the case, noting that “the images could not be clearer or more appalling”.

The Spanish government delegation in Melilla defended the actions of the Guardia Civil, releasing a statement that called the video “biased and manipulated”. Citing aggression on the part of the migrants, it added, “there is no doubt that the officers acted with proportionality”, and noted that five of them were treated for injuries on the day the video was filmed.

The Club Campo de Golf in Melilla has made headlines before. In 2009, Ecologists in Action asked the European Union to open an investigation into the course (pdf). Citing the location as insulting, the organisation asked the EU to investigate why more than €1.1m was given to the project by the European Regional Development Fund, which is meant to “strengthen economic and social cohesion” in the EU and correct imbalances between regions. Their petition was dismissed, with the commissioner noting that the objectives of the golf course were to “increase tourism, create jobs and promote sport and sporting values”.