One of the more unlikely buildings ever designed by Oscar Niemeyer can be found in Brasília, the federal capital he helped conceive and build. The Ministry of Defense is, in many respects, classic Niemeyer: a flat, shoebox structure paired with an ebullient reviewing stand that looks like the curl of a breaking wave. Off to one side, a partially buried auditorium resembles a concrete arachnid, ready to scuttle off into the wild Brazilian plain. The ministry is remarkable for a variety of reasons. For one, it represented a wildly modern piece of architecture for the socially conservative Brazilian military. (As the story goes, the design was approved over classical architecture after Niemeyer asked a high-ranking general, “In a war, do you prefer modern weapons or the classic ones?”)

But, more significantly, it stands as testament to the contradictory impulses of one of the world’s most renowned architects. An outspoken leftist and a long-time member of the Brazilian Communist Party, Niemeyer designed the building for the army in 1967—three years after a right-wing military regime had taken over Brazil in a coup d’état, and the same year he went into self-imposed exile in Europe. In fact, he was working for the very institution that had made his life miserable since the 1964 coup: ransacking his office, hauling him in for questioning, jailing and torturing his friends, and making it difficult for him to work in Brazil. He lost the commission to build Brasília’s airport after the air force minister declared that “the place for communist architects is in Moscow.”

How he set aside his politics and the circumstances of his own persecution to complete the Ministry of Defense is a mystery. Later in life, Niemeyer studiously ducked questions on the subject. There is not a single mention of the project in Curves of Time (2007), his nearly 200-page autobiography.

When Niemeyer passed away in December, just 10 days short of his 105th birthday, the life of one of architecture’s more polemical figures came to a close. He remained an unreconstructed communist in the end, even as his designs appeared to be everything but. His coffin may have been flanked by floral arrangements from Raul and Fidel Castro, but his flamboyant buildings were created in the service of power: sprawling residences for the Brazilian elite, yacht clubs and theaters, the United Nations building (done in collaboration with Le Corbusier and others), and too many government ministries to begin to name.

Niemeyer’s greatest patron, in fact, was a president—one who danced the samba and carried a German .25 underneath his tailored suits. Juscelino Kubitschek was a charismatic former physician who was bent on transforming his country into a modern state. He had previously served as governor of Minas Gerais, a well-to-do mining state—Brazil’s answer to Texas—where he’d overhauled the electrical grid and built almost 2,000 miles of roads. (To this day, Minas has one of Brazil’s top economies, producing much of the country’s iron ore, as well as steel and industrial machinery. Its GDP is third only to São Paulo and Rio de Janeiro.)

As a politician, Kubitschek was as much a visionary as he was an opportunist. He voted to outlaw the Brazilian Communist Party in 1947, yet tacitly accepted the party’s support when he ran for the presidency less than a decade later, thereby winning a three-way election by a hair. Despite taking office with only 36 percent of the vote, he made it a principal goal of his administration to build an ambitious new capital in Brazil’s uninhabited interior. He began planning on Brasília, in the mid-1950s, without holding a competition for the construction contracts, which was in violation of federal law. To cover building costs, he printed money and increased foreign and internal debt. Critics dubbed him “Pharoah Juscelino.” Kubitschek’s response: “The capital is moving, and anybody who tries to stop it will be lynched by the people.”

Though they shared a single-minded determination—not to mention healthy egos—Niemeyer and Kubitschek couldn’t have been more different on an ideological level. Kubitschek was bent on industrializing Brazil, courting investment from the likes of the U.S.; Niemeyer was known for uttering phrases like “capitalism is crap.” Yet, for Kubitschek’s grand oeuvre, Niemeyer nonetheless delivered some of the most iconic modern structures of the 20th century: the National Congress, with its two slim towers and bowl-shaped assembly halls; a presidential palace supported by ethereal spear-shaped arches; and a swirling cathedral draped in stained glass. Recalling a visit to the city in the early 1960s, Soviet cosmonaut Yuri Gagarin said, “I had the impression I had landed on another planet.”

The buildings were breathtaking; the city, wildly futuristic. But the monumental scale of Brasília—in which a handful of powerful men controlled the city’s entire skyscape—hardly seemed to jibe with Niemeyer’s collective ideals. Kubitschek had secured the land, the money, and the political will. Niemeyer produced all of the most important buildings. And the city’s master plan was devised by Lúcio Costa, a Rio-based architect and urban planner who had served as Niemeyer’s mentor and most important champion. For Brasília, Costa devised a layout that consisted of two axes intersecting in a cross. The main government structures inhabited the east-west axis, while residential superblocks ran north to south. The retiring Costa was never a brash political adherent in the Niemeyer mold. (“I am neither a capitalist nor a socialist; I am not religious or an atheist,” he once said.) His innately Corbusian city, with its tidy separation of functions, contains a few nods to transparency and egalitarian values: trees ring residential areas rather than walls, and blocks are numbered instead of being named after colonial heroes. But Brasília wasn’t designed with the intent of making life good for the little guy. Its large scale, Costa explained, communicated that “the city isn’t a province, but a capital;” the cross these axes carved into the savannah was an “act of possession.”

“Even though the rhetoric announced that the new city would create a democratic and egalitarian society,” writes architectural historian David Underwood in Oscar Niemeyer and the Architecture of Brazil (1994), “Brasília is a city born of imperial ambitions and as such could only reinforce the existing colonial structures.” On a symbolic level, the broad boulevards and austere architecture ended up working just as well for the right-wing military dictatorship of the late 1960s and ’70s as it had for the idealistic Kubitschek. In 1970, in fact, military leader Emílio Garrastazu Médici—one of the country’s more notorious human-rights abusers—decreed that cabinet ministers could only conduct their business in Brasília. Critic Robert Hughes described the city as a “utopian horror.” Another later wrote that Niemeyer’s Ministry of Defense was the sort of “structure that would not have looked out of place in Saddam’s Iraq.” Niemeyer nonetheless defended his work and that of Costa’s until the very end. “Brasília works,” he told The New York Times in 2005. “There are problems. But it works.”