The exterior of a two-story brick row house that author Roald Dahl lived in while staying in Washington. (Nathaniel Grann/For The Washington Post)

Prolific British author Roald Dahl, best known for his children’s books featuring a friendly giant, a chocolate factory and precocious kids, started his writing career in Washington — on the subject of war. He wrote his first magazine piece, about his experiences as a World War II fighter pilot, while renting a small house at 1610 34th St. NW in Georgetown.

The Welshman, who was born to Norwegian parents, arrived in the city in 1942 in his mid-20s to work as an assistant air attaché at the British Embassy. Part of his assignment was to promote the British cause during wartime through speeches about his service in the Royal Air Force.

On the third day of his new job, Dahl had lunch near the Mayflower Hotel with C.S. Forester, an English writer celebrated for his Horatio Hornblower series of naval adventure stories. Forester wanted Dahl to tell him about his flying experiences in North Africa, but the young diplomat insisted on writing about them himself.

“That, though I didn’t know it at the time, was the moment that changed my life,” Dahl wrote in a piece published in the 1977 collection “The Wonderful Story of Henry Sugar and Six More.”

Dahl’s colorful war story, called “A Piece of Cake,” describes his ill-fated flying mission as though he were attacked by the enemy. But according to a squadron report, he actually crash-landed his plane in the desert. Forester liked Dahl’s writing so much that he persuaded the Saturday Evening Post to publish the piece. It ran as “Shot Down Over Libya” in 1942.

While living in Georgetown, Dahl penned his first novel, “The Gremlins,” about mythical creatures sabotaging aircraft. Dahl sent a copy to first lady Eleanor Roosevelt, who was charmed by the story and invited him to the White House. Walt Disney flew him out to Hollywood to discuss turning the book into a movie.

Although “The Gremlins” never made it to the big screen, several of his later children’s books did: “Charlie and the Chocolate Factory,” “James and the Giant Peach” and “Fantastic Mr. Fox.” “Matilda,” his 1988 work about a scrappy schoolgirl with telekinetic powers, became a 1996 movie and a 2010 British musical that is now a Broadway hit.

Dahl shared the two-story brick rowhouse on 34th Street with another attaché from the embassy. According to one biographer, the fledgling writer would work during the evenings after watering his tiny garden, pouring himself a whiskey and listening to music.

During his four-year stay in Washington, Dahl was recruited by the British Security Coordination, an espionage network aimed at influencing U.S. policy in favor of Britain. He infiltrated the upper crust of Washington society through parties held at the home of Texas oil tycoon and publishing magnate Charles Edward Marsh. Dahl became part of the Marsh household and frequented the family’s elegant townhouse at 2136 R St. as well as their Virginia country estate. He never lost his taste for the good life, according to journalist Jennet Conant, author of “The Irregulars: Roald Dahl and the British Spy Ring in Wartime Washington.”

Dahl, who died in 1990, wrote about his time in Washington only once, in that piece about his start as a writer included in “Henry Sugar.”

He called the story “Lucky Break.”