(Reuters) - Voters in Chicago have ousted embattled Cook County State’s Attorney Anita Alvarez, who has been harshly criticized for her handling of a police shooting investigation.  Preliminary Democratic primary results on Tuesday showed Alvarez, 56, was handily defeated by Kim Foxx, an African-American who capitalized on criticism the two-term prosecutor received for taking more than a year to charge Jason Van Dyke, a white officer, who fatally shot a black teenager in 2014.   “The stakes in this race were very high,” Foxx said during her victory speech. “I understand the excitement, but let us not get lost in the gravity of the work that is ahead of us.” Foxx, 43, will face Republican Christopher Pfannkuche, who ran an uncontested primary race, in the general election in November. Alvarez will remain in office until then. Killings of black men at the hands of mainly white law enforcement officials in U.S. cities over the past two years have prompted demonstrations across the country and stoked a national debate on race relations and police tactics. Alvarez charged Van Dyke on Nov. 24 with first-degree murder more than a year after he shot Laquan McDonald 16 times. The October 2014 shooting was captured on patrol car dashboard-camera videos that were released on the day Van Dyke was charged, setting off weeks of protests.      Politicians, pastors and civil rights advocates called for Alvarez to resign, saying she only filed the murder charges because she was under pressure after the videos were made public.  “We find ourselves in this country, not just here in Cook County, in a great climate of change and in reform in the criminal justice system,” Alvarez said during her concession speech.  After Van Dyke was charged, Police Superintendent Garry McCarthy was fired and the U.S. Justice Department launched an investigation into the Chicago Police Department.  “This is what justice looks like,” said organizers of Assata’s Daughters, a local black women’s advocacy group, on a Facebook video post.  Foxx served as assistant state’s attorney for Cook County for 12 years and then as chief of staff for the Cook County Board president. Born to a teenage mother, she spent part of her childhood in Chicago’s Cabrini Green public housing complex and in a homeless shelter.  “Kim’s life experience has given her a deep understanding of the impact of crime, violence and poverty on our communities,” her campaign website said.  