After a falling-out over politics, Mateo Morral's father gave his son a monetary parting gift, which he took to Barcelona in 1905. Morral's father was a textiles industrialist in the town of Sabadell, and Morral had traveled widely for his father's company, in addition to his prior studies abroad. He broke with his father over his support of a radicalized group of freethinkers, republicans, and freemasons—the Librepensadores. In Barcelona, Morral grew close to the anarchist pedagogue Francisco Ferrer, whom he had befriended two years earlier. Morral was captivated with Ferrer's Escuela Moderna, a school for rationalist workers' education, and offered the project 10,000 pesetas. Ferrer, in his telling of the story, declined and instead offered Morral a job in the school's library.
A unrequited love interest and a desire for infamy spurred the attempted regicide. While working at Ferrer's school, Morral became infatuated with the director of elementary studies, Soledad Villafranca, but she did not return his private admission of love. Shortly afterwards, on May 20, 1906, he told Ferrer that he would be traveling to recuperate from illness. He went to Madrid, where he walked the streets, attended tertulia roundtables, and sent postcards to Villafranca professing his undying love and his feelings of alienation. Villafranca resided with Ferrer and they were likely lovers, though it is possible that this uncertainty was just as opaque to Morral.
One week before the regicide attempt, a watchman at Parque del Buen Retiro found threats against the king carved into tree bark, which he later attributed to Morral.
Morral used his real name to check into a pension on Calle Mayor, 88. He paid upfront and requested a room facing the street and a daily bouquet of flowers. On the day of the regicide attempt, he requested sodium bicarbonate from the pension's attendant to treat his stomach issues and requested privacy.