From Crispus Attucks in the Revolutionary War to the Tuskegee Airmen in World War II to the tens of thousands serving in the military today, African Americans have always been ready to defend their country. This was true even when racial bias deprived them of equal rights and opportunity in the military.

The national theme of Black History Month this year is “African Americans in Times of War.” Here are three inspiring stories.

From slave to hero

Powhatan Beaty was born a slave in Richmond, Virginia, in 1837. He later gained his freedom and fell in love with acting.

When the Civil War broke out, Beaty, 25, enlisted in the Union army. He was quickly promoted to sergeant and oversaw 47 other black recruits in noncombat jobs. As the war dragged on, the men were given guns and sent into battle.

In September 1864, Beaty’s division attacked the enemy at Chaffin’s Farm, near Richmond. When his unit’s flag-bearer was killed, Beaty braved heavy fire and ran the length of six football fields to retrieve the banner.

With all of the unit’s officers and most of its enlisted men dead or wounded, Beaty took over and led a second charge, driving the enemy back.

For this, Beaty was awarded the Medal of Honor, the nation’s highest military award. He lived a half-century and appeared onstage many times.

A racial pioneer

As a boy, Jesse Brown dreamed of flying. He wrote to President Franklin Roosevelt, asking why there were no black pilots in the military. He got back a form letter saying that would change one day.

Eleven years later, in 1948, he became the first African American the U.S. Navy trained to be a pilot.

Brown had felt the sting of racial taunts all his life. But with the military ending its policy of racial segregation, the 24-year-old ensign was hopeful. “I’m the ­beginning of things to come,” he said.

In December 1950, he was flying his 20th mission of the Korean War when his plane was shot down. He crash-landed on a snowy mountaintop but was pinned in the fiery wreckage. His wingman crash-landed nearby to try to free him. A rescue helicopter also arrived, but Brown remained trapped.

Brown grew steadily weaker and then stopped breathing. With darkness nearing, Brown’s ­wingman didn’t want to leave him. But the helicopter pilot warned, “You stay here, you freeze to death.”

The next day, officers decided that a recovery mission was too risky. Instead, the site was bombed to keep the aircraft and Brown’s body from falling into enemy hands.

The Navy honored Brown by naming a ship after him.

All in the family

Nadja West grew up “eating, drinking, breathing [and] living Army.” Her dad served 33 years, and nine of her 11 older siblings were in the military. She “couldn’t wait” to join.

She also was keen on science, inspired by Mr. Spock, the part-human, part-Vulcan science officer on the starship Enterprise in the “Star Trek” series. “Oh, my gosh, I wanted to be a Vulcan. And I wanted to be a scientist,” West has said.

After high school in Maryland, she went to the U.S. Military Academy at West Point (in just the third class to admit women), followed by medical school. The new doctor served as a captain in the 1990-1991 Persian Gulf War.

West, 56, was raised to work hard and do her best. As a black person and a woman, she was told, others would judge her differently. But it didn’t affect her wartime service. She said her commanding officer asked, “ ‘Doc, can you fix broke soldiers?’ And I said, ‘Yes, sir, I can.’ ” His response? “Glad to have you with us.”

Over the years, more postings and promotions followed. In 2015, West became surgeon general of the Army, its top doctor. She is also the Army’s first black female three-star general and the highest-ranking female graduate of West Point.

Mr. Spock would be proud.

Correction: An earlier version of this story incorrectly stated that Jesse Brown was the first black aviator in the U.S. Navy. Brown was the first black man the U.S. Navy trained to be an aviator and the first black aviator to serve in combat. In 1942, civilian pilot Oscar Holmes became the first black aviator. Because of his light skin, Navy officials thought he was white. The story has been updated.

To learn more

● “Double Victory: The African American Military Experience,” an exhibit at the National Museum of African American History and Culture on the Mall.

● “We Return Fighting: World War I and the African-American Experience,” through March 9 at Harmony Hall Regional Center, Fort Washington, Maryland. Create your own art based on the exhibit at a free program Saturday. “The Art of War” event, noon to 3 p.m., is for all ages. and

● The African American Civil War Museum, 1925 Vermont Ave. NW. Students visiting in February get a free book.