Miguel M.S. was one of 21 adults and three juveniles arrested in the violent aftermath of the peaceful 'March for Dignity' demonstration which attracted tens of thousands of people protesting against the state of the Spanish economy.
Clashes broke out between police and groups of youths and quickly escalated.
101 people were hospitalized, 67 of them police officers, and a man lost a testicle after being shot with a police rubber bullet.
Protesters have accused police 'infiltrators' of instigating the violence while police groups lay the blame at the feet of 'radical elements'.
According to Spanish daily El País, most of the people arrested are from the autonomous Spanish region of Galicia.
Police sources told the newspaper that 400 'radicals' with ties to Galician independence arrived in the capital by train.
They are said to have used slingshots with steel pellets to attack police, as well as throwing stones and other items they found on the streets including tables and chairs.
Other people arrested included two men from the Basque Country, a woman from Zaragoza and a man from Italy. The rest were from Madrid.
Most have been charged with attacking officers of the law, public disorder and vandalism.
The attempted murder charge against Miguel M.S. is the first time such an accusation has been made against a protester in Spain.
He is said to have been part of a group who launched a series of attacks against the officer, knocking him to the ground and kicking off his helmet. He is then accused of having tried to strike the officer in the head with a rock "of large dimensions" which the officer only narrowly managed to avoid.
The officer was taken to hospital and treated for a large cut on his head before undergoing scans for possible brain or skull injuries.
Hundreds of people gathered outside the Madrid courthouse in Plaza Castilla on Monday to demand the release of those arrested.
Most detainees were later released pending charges but a judge ruled that Miguel M.S. should be jailed without the possibility of bail while awaiting trial for the more serious accusation.