A Somali-born American was elected to the city council of Maine’s second-largest city on Wednesday despite a barrage of nasty attacks and threats on social media.

Safiya Khalid, 23, soundly defeated a fellow Democrat for a seat on the Lewiston City Council.

Shrugging off the attacks, Khalid declared that her victory is proof that "community organizers beat internet trolls."

The hateful messages that poured in from across the country attacked her religion and her skin color, she said. Someone said she should be stoned. Another person shared her home address on a Facebook group.

"My reaction was how can people be so mean and full of hate? I was left speechless. It was all about intimidation," she said. She deleted the Facebook app from her phone and deactivated her Twitter account.

AYANNA PRESSLEY, IN BREAK FROM THE 'SQUAD,' BACKS WARREN FOR PRESIDENT

Maine is home to a growing population of Africans who have fled their homeland.

Somalis began moving to Lewiston two decades ago in search of affordable housing after many settled in Portland. The city of 36,000 – second in population in Maine only to Portland – is now home to more than 5,000 Africans.

Khalid was born in Somalia and lived in a refugee camp before coming to the United States.

CLICK HERE TO GET THE FOX NEWS APP

"When I came here, I didn't know how to write my name or speak any word of English,” she said. “I am who I am because of public education. Our children deserve the highest-quality education.”

The Associated Press contributed to this report.