Casey Handal was hosting a gingerbread decorating party at her Barrington, Ill., home in December when she glanced out her window and noticed something unnerving. The rainbow pride flag she and her fiancée flew from their backyard flagpole was gone, replaced by the Stars and Stripes.

Though Handal considers herself a proud American, she saw the uninvited flag swap as a hostile gesture aimed at the only openly gay couple in the neighborhood.

“I think the message was quite clear,” she said. “I think if somebody would have just taken the flag and not replaced it with anything, that wouldn’t necessarily have sent quite the same message. It’s more premeditated this way.”

Handal went onto the Nextdoor social network to share her alarm and ask if anyone had seen the thief. Her friends were sympathetic, as were neighbors she had never met. But what came next was a surprise — an act of solidarity that turned a disturbing experience into a vibrant show of unity.

Dozens of neighbors are now displaying rainbow flags outside their own homes, tucking them into their mailboxes and planting them into their front lawns. Some even incorporated them into their Christmas decorations last month.

“Especially in the climate we’re in, it just shows there are a lot of people who have a lot of love in their hearts,” said Kristin Cannon, a friend and fellow resident.

“That love is bigger than the discrimination against a family like theirs.”

Handal and Zadette Rosado moved into their lakeside home in May, eager to raise their daughters — Payton, 9, and Reese, 7 — in a close-knit and peaceful community with amenities such as a swimming pool and tennis courts.

Their house came with a flagpole in the backyard, and they decided to use it to fly a rainbow flag. It wasn’t meant to be a political statement, Handal said.

“It was just there to represent our family,” she said. “The girls loved it, and not just because it’s pretty. Every time they’d have a friend come over they’d be like, ‘Hey, look at our flag. Isn’t it cool?’ ”

The new American flag didn’t come with a note or explanation, but Handal said the intent was obvious enough. This didn’t appear to be a kid’s prank — how many kids today, she asked, even know how to raise a flag? — but something rooted in hate.

She reported the theft to police, though she said she wasn’t really looking to press charges. She just wanted to speak to the person who had shaken her family’s sense of security, to learn why they did it and try to convince them of their shared humanity.

Reaction was almost immediate. Neighbors assured her that the theft was not representative of their neighborhood, and to drive that point home, Kimberly Filian, a high school social worker, ordered four dozen small rainbow flags for neighbors to display.

“I’m so sick of all this hate,” Filian said in an interview. “I felt like it was one thing I could do to show support — just something little.” Soon, the flags were everywhere.

Handal said the heartening reaction has convinced her not only that she picked the right place to live, but that something good can flower in the aftermath of something terrible.

“The fact that this story might make someone smile, maybe it’s not so bad, and maybe the hate we see so much is not the mass of people but individuals,” she said. “I think it makes it all worth it if this crummy thing that happened can lead to spreading more joy and happiness in the world.”