LAGOS (Reuters) - Nigeria's former national security adviser, held since December 2015 on fraud charges, should be released, a judge at the court of the Economic Community of West African States (ECOWAS) ruled on Tuesday, saying his detention was unlawful and arbitrary.

Sambo Dasuki has been accused of fraud involving $68 million of defense spending, part of a wider $2.1 billion in arms deals under investigation. He has pleaded not guilty.

He served under Nigeria's former president, Goodluck Jonathan, who was defeated in last year's election by Muhammadu Buhari, a former military ruler who has promised to crackdown on corruption.

The judge at the ECOWAS Court of Justice, sitting in Nigeria's capital Abuja, ruled that Dasuki should be released immediately and the government should pay him 15 million naira ($46,606) in compensation for his arrest and detention.

The ruling by Justice Friday Chijioike Nwoke said Dasuki's "arrest, detention and continued detention" after having been granted bail by three different domestic courts was "unlawful" and "arbitrary".

However, sovereign states do not have to respect the court's rulings and there is no framework for making them binding.

(Reporting by Alexis Akwagyiram; Additional reporting by Tim Cocks in DAKAR; Editing by Janet Lawrence)