General Karenzi Karake was arrested on a European Arrest Warrant issued by Spain in June and had been on bail but the case was dismissed following a hearing at London's Westminster Magistrates Court.
After the arrest at London's Heathrow airport, a Spanish judicial source said Karake was accused of "crimes of terrorism" linked to the killing of nine Spanish citizens in Rwanda in the mid-1990s.
British police said the 54-year-old was arrested over alleged "war crimes against civilians".
Karake's defence lawyers and prosecutors in the case gave different reasons for why the general, a key figure in the regime of President Paul Kagame, had been freed by the court.
"The general has been freed unconditionally after the Spanish authorities conceded that the general has committed no offence that could be prosecuted in both England and Spain," a statement from Omnia Strategy, the firm representing him, said.
Omnia Strategy was founded by Cherie Blair, wife of Britain's former prime minister Tony Blair, whose Africa Governance Initiative has advised Kagame. Cherie Blair also led Karake's legal team.
But a Spanish judicial source told AFP that the judge in the case believed "the UK was not competent to hear such offences committed outside British territory."
The Crown Prosecution Service, which oversees prosecutions in England and Wales, said the case was dismissed because "the relevant laws on the conduct alleged in this case do not cover the acts of non-UK nationals or residents abroad."
Karake was one of the main commanders of the armed wing of the Rwandan Patriotic Front (RPF), the Tutsi rebel group that ended the Rwandan genocide in 1994 and has held power ever since.
At least 800,000 mostly Tutsi people died in the genocide. In 2008-2009, he was deputy commander of the United Nations-African Union Mission (UNAMID) in Sudan's war-torn Darfur region.
It was at this time that a Spanish judge issued an arrest warrant against him, causing tensions between Rwanda and the UN and his premature departure from the peacekeeping force.
The Spanish investigation covered allegations of genocide, war crimes, crimes against humanity and terrorism in Rwanda in the 1990s.
It later shelved the first three sets of charges, leaving the case to focus on "crimes of terrorism" in the case of the nine Spaniards killed in Rwanda.
The London court's move was welcomed Monday by Rwanda's Minister of Foreign Affairs Louise Mushikiwabo, who wrote on Twitter: "Delighted! Gen. KK coming home! This was an unnecessary and abusive process..."
Rwanda had reacted furiously to his arrest, with Kagame saying it showed "absolute arrogance and contempt".
The African Union also called for his "unconditional and immediate" release.