Six-year-old Joseph Bonner cried frequently in school. He struggled through tears to write his ABCs. He broke down on the playground. He wept when his pencil broke.

He could barely get through a school day, his mother and teacher said. The typically calm, quiet boy missed his father.

For the last six months, Air Force Master Sgt. James Bonner has been in Guantanamo Bay, Cuba, on an unexpected deployment, his first in nine years.

Joseph couldn't quite understand why his father had left.

"He missed his dad," said Jennifer Taylor, Joseph's kindergarten teacher at Gregg Anderson Academy in Palmdale. "I thought maybe we could work through it."

Taylor decided that including his classmates might help. The students talked about Joseph's father and his service. They wrote him letters, drew pictures and assembled a care package. Because the package was compiled by kindergartners, it contained mainly candy. But the students also included sunscreen, baby wipes, cookies and soup.

Joseph began to smile more and cry less. Talking about his father seemed to help, Taylor said, and so did the support of his classmates.

But the best was yet to come. At an assembly Wednesday, Sgt. Bonner surprised his family and the school with a visit.

After Joseph and his class sang a rendition of "You're a Grand Old Flag," Bonner walked onto the playground, his camouflaged uniform catching the eye of his wife, Michelle, who did a double-take and squinted to be sure. With a gasp, she realized her husband was home.

Joseph, gripping the American flag he had colored in crayon, appeared confused and shocked. He darted toward his father. His 9-year-old brother, Marcus, ran from the other end of the playground.

The students were thrilled. No one thought he would be home for at least another week.

Bonner said he received the students' care package while he was at work. He thought about opening it, but waited until he got home. "I didn't want to break down," he said.

The first item he pulled out was a letter from his son: "Dear Dad, Have a great day and I like snakes too."

"It was so cool," Bonner said. "Yet so, so sad. I wanted to be there and hang out with them."

Last week, Joseph and his class had written another round of letters to Bonner. First-graders now, their writing skills had improved. "I hope you liked the candy we send you. I love you," one girl wrote. A boy thanked Bonner for "keeping us safe from the bad guys." Another wrote: "I have a rainbow for you."

Joseph gripped his pencil tightly. "I miss you daddy…," he wrote, "and I hope you come back soon." Then he drew an airplane flying toward their home.

At home, Michelle, an Air Force veteran, had put on a strong front for the children. "If they see me get sad and cry, they do the same," she said.

The couple met while stationed in Tokyo and married soon after, living in Germany and Washington state before settling in Palmdale when Bonner was assigned to Edwards Air Force Base. After rising in rank over 20 years, they thought they might be safe from another deployment — but then came word that he was headed to Cuba.

Michelle understood the commitment and sacrifice service members make, but the time without him was torture.

"It feels like he went to work and never came home," she said. "We try to keep busy but it's just not the same. It's not family time without Dad."

Bonner arrived at Edwards Air Force Base early Wednesday. He drove by his home a few times before dawn to check on his family.

"That's what daddies do," he said. "I checked and made sure everyone was well and good and that the house was secure."

A few hours later, the school gathered for the patriotic-themed ceremony.

The family hugged — Joseph, his eyes teary, gazed up at his father.

"You OK, buddy?" Bonner asked as he lifted his boy.

Joseph nodded as tears fell onto his father's uniform.

stephen.ceasar@latimes.com