Why were enslaved African Americans barred from enlisting in the war?

Which war? Which side barred them?