Afghanistan ratifies security agreements with NATO, US