An attempted assault on an officer at a police station near the Spanish city of Barcelona is being treated as an act of terrorism, police said on Monday. An Algerian man armed with a knife entered the station just before 6am shouting "Allahu akbar". The 29-year-old was shot dead by the police. "We are treating it as a terrorist attack," Rafel Comes, a commissioner with the Catalan regional police, told a news conference in Cornella de Llobregat, where the incident took place. "The officer used his gun to save his own life." "A man armed with a knife entered the police station in Cornella to attack the officers. The attacker was shot," the Catalonia regional police later said on Twitter. . The attempted assault came days after the first anniversary of the terrorist attack that killed 16 people and injured more than 100 when a Moroccan man drove a van into pedestrians on a central street in Barcelona in Spain's worst terrorist incident in more than a decade. Also on Monday, in the town of Casetas near Zaragoza a car mounted a pavement injuring three pedestrians before its driver fled. The injured included a 45-year-old man who was taken to a nearby hospital. Two other people were taken to a different hospital, a civil protection agency spokeswoman said. Local radio station COPE tweeted that two people in the car were detained shortly afterwards. The driver tested positive for drugs and alcohol, it said, and the incident was being treated as a traffic accident.