A Civil War-era Medal of Honor recipient forgotten in an unmarked grave for nearly a century finally got a funeral Thursday when he was given full military honors and reburied at a national cemetery.

The Army gave Sgt. Charles Schroeter a rifle salute and a bugler played taps on the cloudy morning at Miramar National Cemetery. Scores of veterans from past wars ranging from Vietnam to Afghanistan attended the ceremony. Some dressed in uniforms and dresses from the Civil War era. Among the crowd were two Medal of Honor recipients.

Schroeter was found thanks to efforts to locate all those awarded the nation's highest military award.

"On behalf of a grateful nation, may you find this new place of rest to be the home of honor you rightfully deserve," Army Brig. Gen. Joseph M. Martin told the crowd.

The German-born U.S. soldier was given the Medal of Honor in 1869 for his gallantry during battles between settlers and Native Americans out West.

Researchers from the Medal of Honor Historical Society of the United States discovered records showing Schroeter's ashes were in an unmarked crypt with other unclaimed remains at the private Greenwood Memorial Park in San Diego. The group sent a Medal of Honor plaque to the cemetery staff in 2013 to have it placed on his grave. That's when the cemetery's staff learned Schroeter — who never married and had no children — was buried in the grave space set aside for unclaimed cremated remains.

"I thought, 'Ugh,'" said Cathy Fiorelli, director of Greenwood Memorial Park who also serves on the board of the Miramar cemetery's foundation. "This guy should be buried at our national cemetery. It feels more befitting, proper and appropriate as the final resting place for a war veteran and Medal of Honor recipient."

Fiorelli submitted the necessary paperwork.

Schroeter is the first Medal of Honor recipient buried at San Diego's newest national cemetery.

The box containing his remains was put in a horse-drawn hearse. An honor guard from Fort Irwin's 11th Armored Cavalry accompanied the hearse to the cemetery's Memorial Circle as Marine Corps fighter jets conducted training flights nearby.

The honor guard presented the flag to the cemetery director, acting as next-of-kin because no one has located any descendants.

According to the Medal of Honor Historical Society, about 400 Medal of Honor recipients are listed as "lost to history" because their burial location is unknown.

Historians try to track down every detail they can by scouring records.

Researchers say Schroeter was born on July 4, 1837, in Luneburg, Germany. He migrated to the United States as a young man. He spent the next three decades serving in the U.S. military, joining the 1st Volunteer Missouri Cavalry Regiment in 1863 in which he fought against Confederate soldiers in Arkansas. After the Civil War, he joined the U.S. 8th Cavalry and headed out West.

Schroeter was awarded the Medal of Honor for his courage during the Battle of Rocky Mesa on Oct. 20, 1869, which was sparked by an Apache attack on a stagecoach that killed two civilians and four troopers. He and his comrades tracked the Apaches into Arizona's Chiricahua Mountains, where they survived against rifle fire that killed two men and wounded another before darkness brought an end to the fighting.

"He devoted his life to his adopted country," said Bill Heard, spokesman for the Miramar National Cemetery Support Foundation. "He suffered bullet wounds, sabre cuts and he was a little guy, about 5-foot-6 and 135 pounds. He was tough as nails. He deserves to be buried among his comrades in arms."

Schroeter also served five years in the Marine Corps before retiring from the military and opening a candy and tobacco shop in Buffalo, New York.

He moved to San Diego in 1918.

A white marble gravestone stands among rows of military heroes with his name, service, birth and death dates in gold inscription and with the Medal of Honor insignia.