When the test scores came out, Lucas Siqueira, 27, was really excited. His high mark on the Foreign Service exam earned him a coveted position at Brazil's highly competitive Ministry of Foreign Affairs.
"They hire 30 diplomats a year and thousands of people sign up," he says in fluent English from his home in Brasilia, the capital.
It was, he says, a great day.
Siqueira considers himself to be mixed race, known in Brazil as pardo, or brown.
"I consider myself to be a very typical Brazilian and I've always been very proud of it. In my dad's family, my grandfather is black, my grandmother has Indian and white roots. And on my mother's side they are mostly white, mostly Portuguese," he said.
How he defines himself matters because he was required to self-identify on his application. In 2014, the government introduced a quota system for federal jobs. The affirmative action regulations require that 20 percent of all government positions be filled by people of color — either black or mixed race.
The problem came once the announcement of the appointments was made public.
People started investigating the background of who had gotten the slots. They got into Siqueira's Instagram, his Facebook feed and they sent his personal photos to the government.
"A lot of people sent pictures saying, 'Oh, this dude is white, he's a fraud,'" Siqueira says.
Job offer put on hold
People basically said he was gaming the system, lying about who and what he is to get one of the jobs. The backlash shocked him. He said he hadn't even considered the quota system. He just put down what he considered himself to be.
But the controversy wouldn't go away. The government was getting so much flack that it put Siqueira's offer on hold.
And then the government went a step further.
In response to the outcry, it set up a kind of race committee to review his case, and a few others.
He was asked to present himself to a panel of seven diplomats in a room who would decide if he was really Afro-Brazilian, as he claimed.
They asked him a bunch of questions such as, "Since when do you consider yourself to be a person of this color?"
And then it was over.
What they decided was that he was not pardo, or mixed race. No explanation. No discussion. So he decided to sue.
And that's when this story gets even more complicated. Because in order to "prove" that he was Afro-Brazilian, his lawyers needed to find some criteria. He went to seven dermatologists who used something called the Fitzpatrick scale that grades skin tone from one to seven, or whitest to darkest. The last doctor even had a special machine.
"Apparently on my face I'm a Type 4. Which would be like Jennifer Lopez or Dev Patel, Frida Pinto or John Stamos. On my limbs I would be Type 5, which is Halle Berry, Will Smith, Beyonce and Tiger Woods," he said.
Like most people he has different skin tones on different parts of his body. But in none of these tests did he come out as lighter skinned.
He says the whole thing struck him as completely bizarre because identity, he says, is made up of more than just physical characteristics.
But this wasn't just an isolated incident.
Mandatory for all government jobs
A few weeks ago, these race tribunals were made mandatory for all government jobs. In one state, they even issued guidelines about how to measure lip size, hair texture and nose width, something that for some has uncomfortable echoes of racist philosophies in the 19th century.
"It is something terrible. I believe this kind of strategy can weaken the support of society for affirmative action policies," says Amílcar Pereira, an associate professor at the School of Education in the Federal University of Rio, who studies race relations. "These policies have huge support ... the majority of Brazilian society supports affirmative action."
"But this kind of commission can jeopardize the support because it's so controversial. It's unacceptable to come back to the 19th century, to determine who is black and who is not," he says.
But the race commissions have a lot of support from the black community.
Leizer Vaz is coordinator of NGO Educafro, which works to open up access to education for black Brazilians. He, like most black activists here, supports the commissions. The reason is simple — history.
"We are very far from the equality," he says from his home in Sao Paulo.
Brazil was the last place to give up slavery in the Americas, abolishing it in 1888. The country imported more enslaved Africans than any other — some 5 million.
The legacy of the period can still be felt today. Even though the majority of the population is of African descent, only 5 percent of Afro-Brazilians were in higher education as recently as 10 years ago. Because of affirmative action, that number is now 15 percent. Vaz says these are hard won gains, but there is a long way to go.
"Only 5 percent of executives are black in Brazil, politicians, diplomats, all things, so the black people don't access the space of power in my country. This is the real issue we have," he says.
In the U.S., race is still largely determined by parentage because of the history of the "one drop rule," where white institutions historically deemed a person black if they had even one drop of black blood.
In Brazil, he says, the criteria is different. Skin tone matters more than race, because so much of the population is mixed.
"Who is more affected by racism? Who has the chance to be more affected by (discrimination) in this country?" he says.
He says the commissions are good because they act as a deterrent for those who want to take precious government jobs away from marginalized groups.
"In my opinion the value of the commission is to (keep out) white people who intend to make a fraud," he adds.
He acknowledges that determining this will be messy in a country where 45 percent of the population considers themselves mixed race.
But ultimately, he says, Brazil is trying to right a historic wrong.
"It's controversial, but the general result is good. Because we are giving a chance for poor black people to access the space of power that we never had this in Brazil," he said.
Lucas Siqueira, who is still waiting for his case to be resolved, says he understands that there is racism in Brazil, but he doesn't think it is the government's job to determine what someone is.
"I think we are going down a very dangerous path if we want to institutionalize these kinds of racial tribunals," Siqueira says.
He says he sits in the middle: not white, not black, and now, not embraced by either side.