Police threatened in stand-off, court told