An eight-year-old boy has been handed over to Spain’s child protection services after he was found curled up in a suitcase as a woman attempted to smuggle him across the border from Morocco.

Guardia Civil agents noticed that the 19-year-old woman was reluctant to pass through border controls at the Spanish enclave of Ceuta, and asked her to place her fuchsia-coloured, wheeled suitcase in an x-ray machine, expecting to find drugs or illegal merchandise inside.

Instead, the figure of a young child was clearly outlined in the x-ray. When guards opened the bag, the boy emerged from the suitcase scared and confused, telling authorities that his name was Abou, he was eight years old and from the Ivory Coast.

The woman accompanying the boy, identified as a Moroccan national, was arrested. A Guardia Civil spokesperson said the boy was in a terrible state and that the situation “could have ended tragically”.

Facebook Twitter Pinterest A picture provided by the Spanish Guardia Civil of the boy as he got out of the suitcase. Photograph: Reuters

Less than two hours later, the Guardia Civil flagged a man originally from the Ivory Coast and currently a resident of the Canary Islands as he crossed the same border. When they showed him photos of the young boy in the suitcase, he admitted that the boy was his son.

“I just wanted to take him with me to the Canary Islands,” he reportedly told the agents. He was arrested and the child was put in the care of child protection services.

Police said the young woman was not related to the boy and said they believed that the boy’s father had paid her to attempt to smuggle the boy into Spain.

Each year thousands of migrants risk their lives to cross into Spain through the northern Africa enclaves of Ceuta and Melilla, hoping to find a better life in Europe. Last year fewer than 5,000 were successful in making it across the border.

As Spanish authorities step up efforts to crack down on the migrants, many have become more creative, resorting to stowing away in false-bottom cars or in shipping containers.