HOWELL, Mich. (CBSDC/AP) — Republican presidential candidate Ted Cruz is apologizing for making a joke about Vice President Joe Biden days after his son died of cancer.

The incident happened while the Republican Texas senator was speaking at a Livingston County Republican dinner in Howell, Michigan, Wednesday night, according to Chad Livengood of The Detroit News.

“You know the nice thing? You don’t need a punch line,” Cruz said to loud applause and laughter. “I promise you it works. The next party you’re at, just walk up to someone, say ‘Vice President Joe Biden,’ and just close your mouth. They will crack up laughing.”

Cruz continued: “Biden said, ‘Anyone attacks your house, just go outside with a double barrel shotgun and fire both barrels in the air.’ Now that is very, very good advice, if it so happens you’re being attacked by a flock of geese.”

When asked about Beau Biden’s death by Livengood, Cruz said it was “heartbreaking and tragic.”

“And our prayers are very much with Vice President Biden, with Jill. It’s a tragedy no one should have to endure,” the Texas senator stated.

When asked why he joked about the vice president days after his son’s death, Cruz walked away.

Cruz apologized for the joke following the speech.

“It was a mistake to use an old joke about Joe Biden during his time of grief, and I sincerely apologize,” Cruz said in a statement. “The loss of his son is heartbreaking and tragic, and our prayers are very much with the Vice President and his family.”

Beau Biden passed away last Saturday after battling brain cancer for nearly two years. He was 46. He will lie in honor Thursday in the state Senate chamber, following a processional from Wilmington to Dover.

Thursday’s services are the first in a series of public commemorations, which include a viewing at St. Anthony of Padua church in Wilmington on Friday, followed by a Saturday funeral Mass at which President Barack Obama will deliver a eulogy.

Biden opted not to seek a third term as attorney general last year, saying he would run for governor in 2016, but his health declined after doctors discovered a brain lesion in 2013.

(TM and © Copyright 2015 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2015 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.)