Close ties between the royal families of Spaininfo-icon and Saudi Arabiainfo-icon could help Madrid conclude a lucrative deal to sell warships to Riyadh, much to the alarm of rights groups.

They claim the sale would be illegal under international law and accuse the oilinfo-icon-rich kingdom of carrying out warinfo-icon crimes in its military campaign in Yemeninfo-icon, which has killed thousands of civilians.

Spain's King Felipe VI will on Saturday begin a three-day official visit to the Middle Eastern country at the invitation of Saudi Arabia's King Salman.

Spanish mediainfo-icon has linked this visit to a much anticipated deal to sell Avante 2200 corvettes for an estimated two billion euros ($2.1 billion).

"We can only confirm that negotiations are very advanced to build five warships which would be sold to the Saudi navy," a spokesman for state-owned Spanish ship builder Navantia told AFP.

Spain is currently the seventh largest arms exporter in the worldinfo-icon.

Its arms exports jumped by 55 percent in 2011-15 over the previous five years, according to the Brussels-based Group for Researchinfo-icon and Information on Peace and Security.

And its sales to Saudi Arabia, the country with the highest military expenditure per capita, are on the rise.

'Clearly illegal'

"The question is: is the contract legal or illegal. And it is clearly illegal," said Alberto Estevez, an expert on arms sales at the Spanish branch of Amnesty Internationalinfo-icon.

A 2013 United Nationsinfo-icon global arms trade treaty bans the sales of arms which could be used in attacks against civilians or other violations of humanitarian law, he said.

A Saudi-led coalition began air strikes over Yemen in March 2015 after Huthi rebels and their allies, troops loyal to ex-president Ali Abdullah Saleh, overran much of Yemen.

Riyadh feared the Huthis would take over all of Yemen and move it into the orbit of Shiite Iraninfo-icon, Sunni Saudi Arabia's regional rival.

A coalition of rights groups in Spain, including Amnesty and Oxfam, has outlined dozens of alleged war crimes carried out by the Saudi-led coalition, such as the bombing of hospitals and schools.

The Spanish corvettes could be used for more than just patrols, warned Jordi Calvo, a researcher at Barcelonainfo-icon's Study Centre for Peace J.M. Delas.

They can be equipped with missileinfo-icon systems or cannons, and helicopter launch pads, he said.